自动打开的报告会执行未固定的第三方 CDN 脚本,并启用 Mermaid 宽松安全模式
原文依据:4 处报告模板从 cdn.tailwindcss.com 加载浮动脚本,并从 jsDelivr 加载仅固定到主版本 11 的 Mermaid;这些脚本会在报告打开时执行。Mermaid 还被配置为 securityLevel: "loose"。仓库内容会用于生成图表和报告,但指令没有要求对插入 HTML 或 Mermaid 的文字进行转义。
CDN 内容若被篡改、供应链受损或版本行为改变,第三方代码可读取报告 DOM(包括文件名和架构结论)并发起网络请求。若恶意仓库文字未经转义进入宽松模式的图表,还可能生成主动内容或欺骗性报告。
报告被要求自动打开;打开时浏览器会执行来自两个第三方 CDN 的代码,其中 Tailwind 未固定版本,Mermaid 只固定到主版本 11,并使用较宽松的安全模式。若 CDN 内容遭替换,或仓库文字未经 HTML/Mermaid 转义就进入报告,第三方脚本或构造内容可能在报告页面的浏览器权限内运行。源码未证明仓库文字确实未经转义,因此该部分是条件性风险。用户可要求作者固定带完整版本与完整性校验的资源、改为本地静态资源、使用严格模式并明确转义规则,或限制自动打开/网络访问。
Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.The report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.查看另外 3 个位置
<meta charset="utf-8" /> <title>Architecture review for {{repo name}}</title> <script src="https://cdn.tailwindcss.com"></script> <script type="module"> import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs"; mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" }); </script> <style>- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.