Archify
Archify 安全与运维:让生成图表可审查且安全
覆盖不可信 JSON、来源链接、HTML/SVG、CI 权限、外部资源、资源上限与回滚。

你将学会
- Threat-model Archify inputs and exports
- Design least-privilege CI operations
- Govern semantic claims and incident rollback
开始前需要
- Basic Git and command-line usage
- Comfort reading a project README
You can explain the project, run its documented first step, and decide what to verify before adopting it.
先看结论
- Typed JSON, source links, and generated HTML/SVG all need input validation.
- Isolate rendering, restrict egress, and run CI with read-only least privilege.
- Review semantic claims and keep rollback and redacted incident evidence.
Treat authored and agent JSON as input
代理生成的 JSON、来源链接和自包含 HTML/SVG 都是输入边界:校验 schema、长度、ID、URL 和关系数量,隔离渲染资源,默认限制外部请求,CI 使用只读权限,并保留 last-good 产物与脱敏事件用于回滚和审查。
A source trace should link to an expected, reviewable location. Reject unexpected schemes, path traversal, and links that escape the evidence boundary. If a diagram is public, redact secrets and private topology before rendering rather than relying on viewers not to inspect the HTML.
Harden HTML, SVG, and motion
Self-contained HTML/SVG is convenient but executable. Escape text and attributes, sanitize or remove embedded scripts, restrict external requests, and set safe download content types. Treat finite motion and interaction handlers as code paths that deserve tests, not decoration.
Render in an isolated process with bounded CPU, memory, and output size. A malicious label or graph should fail closed with a clear validation error instead of consuming an unbounded CI runner or producing an artifact that phones home.
Operate CI with least privilege
The generation job usually needs read-only source access and a dedicated artifact directory. Do not grant repository write tokens or cloud credentials to a diagram renderer unless a separately reviewed publishing step requires them. Record skill revision, input revision, validation status, export checksum, and external-request policy in build metadata.
Keep last-good output and a rollback revision. If a new skill or fixture exposes sensitive data, stop publication, remove the artifact from distribution, rotate only affected credentials, and preserve a redacted trace for the incident review.
Govern the meaning, not only the bytes
Security controls cannot prove that a topology is complete or that a source edge is semantically correct. Require a reviewer to approve high-impact diagrams, document unresolved facts, and keep a distinction between observed code, authored assumptions, and generated suggestions. Add regression fixtures for injection text, unsafe URLs, duplicate IDs, and oversized graphs.
如何选择
| 比较维度 | 方案 A | 方案 B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
实施步骤
- 1
Validate JSON fields, URLs, IDs, lengths, and relationship counts.
- 2
Escape/sanitize HTML and SVG and bound renderer resources.
- 3
Use read-only CI credentials and record revisions, policies, and checksums.
- 4
Rehearse publication stop, selective credential rotation, rollback, and review.
可复制示例
archify_security:
input: schema_and_length_validated
source_links: [https_only, allow_list]
renderer: isolated
external_requests: disabled_by_default
ci_token: read_only
artifact: last_good_on_failure常见问题
Is self-contained SVG automatically safe?
No. Escape content, sanitize attributes/scripts, restrict external requests, and test untrusted labels and links.
Should the renderer have repository write access?
Normally no. Give it read-only source access and publish artifacts in a separately reviewed step.
资料来源
- Archify README (captured 2026-08-31)来源核查 2026-08-31
- Archify repository来源核查 2026-08-31