fix(active-content): raw-html graded two inert shapes HIGH, and the fix moved a second surface
`is_active_tag`'s URL-attribute branch was a presence test: any element carrying `href=`/`src=`/`action=` graded HIGH regardless of where the URL pointed. An MDX `<Card href="/en/agent-sdk/quickstart">` reaches no attacker-controlled host, and neither does APIM policy XML's `<set-header>`. It now requires an external target -- the rule the markdown paths have applied since 0.3.1. `<base>` left the active name set in the same change: HTML's `<base>` has its whole affordance in an `href` the attribute branch still catches, and APIM's attribute-less `<base />` is inert. Measured before and after in ONE session against one corpus state, because two of the three corpora are living and a split would mix this with re-harvest drift: reference-corpus 389 docs 133 -> 108 (ceiling 107) vendor-harvest 187 docs 100 -> 98 (ceiling 62) generated-notes 550 docs 90 -> 88 (ceiling 49) 96% of the achievable reduction in reference-corpus, 5% in the wiki corpora. The two classes had to be measured TOGETHER -- alone they free 3 and 13 documents, together 25, because a document carrying one usually carries the other. The second surface: `neutralize` imported `is_active_tag` by name, so this would have silently narrowed the opt-in mutator too -- and no test discriminated the two halves, since every `neutralize:raw-html` payload stays active under any narrowing considered. That test is written first here. The predicates are now separate symbols; the mutator keeps defanging anything, because over-defanging is auditable and blocks nothing while under-defanging hands a human a live construct. Behaviour change: a document whose only finding was one of these classes now WARNs instead of holding. Detection is unchanged -- 128/128 classes, 6/6 gaps hold. Self-safety: reading an attribute VALUE needs a pattern the presence test lacks. It reuses the same literal alternation so no new run shape enters the table; its `_REDOS_PAYLOADS` row denies the `=` the pattern requires, since a unit supplying it matches at once and never exercises the run (the lexicon's `script-tag` row is the cautionary case). 0.031-0.046s across five attack shapes at 100_000 chars against a 2.0s bound; `docs/redos-sweep.py` reports 0 candidates of 152. An attribute the presence test saw but the value parser cannot read counts as external -- fail secure. `docs/rawhtml-census.py` gains a PRODUCTION row that re-measures the shipped predicate rather than a hypothesis, so a published number and the code cannot drift apart unnoticed. README's limitation count moves 34 -> 33. 727 passed (was 717).
This commit is contained in:
parent
e671edb96f
commit
736f370cfb
9 changed files with 287 additions and 72 deletions
71
CHANGELOG.md
71
CHANGELOG.md
|
|
@ -7,7 +7,76 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
Nothing yet.
|
||||
### Changed — `active:raw-html` stops firing on two things that carry no affordance
|
||||
|
||||
`is_active_tag` had two over-reaching branches, both measured on consumer corpora
|
||||
rather than argued from the code:
|
||||
|
||||
- **The URL-attribute branch was a presence test.** Any element carrying `href=`,
|
||||
`src=`, `action=` … graded HIGH regardless of where the URL pointed. An MDX
|
||||
`<Card href="/en/agent-sdk/quickstart">` — an internal doc route — reaches no
|
||||
attacker-controlled host, and neither does Azure APIM policy XML's `<set-header>`.
|
||||
The branch now requires an **external** target (absolute scheme or
|
||||
protocol-relative), the rule the markdown paths have applied since 0.3.1.
|
||||
- **`<base>` left the active name set.** HTML's `<base>` has its entire affordance in
|
||||
its `href`, which the URL-attribute branch still catches. APIM's attribute-less
|
||||
`<base />` means "run the inherited policy" and is inert in every renderer.
|
||||
|
||||
**Measured before and after in one session, against one corpus state** — the two
|
||||
wiki corpora are living, so a before/after split across sessions would mix this
|
||||
change with re-harvest drift:
|
||||
|
||||
| population | n | before | after | ceiling (raw-HTML off) |
|
||||
|---|---|---|---|---|
|
||||
| reference-corpus | 389 | 133 | **108** | 107 |
|
||||
| vendor-harvest | 187 | 100 | **98** | 62 |
|
||||
| generated-notes | 550 | 90 | **88** | 49 |
|
||||
|
||||
96% of the achievable reduction in reference-corpus, 5% in the two wiki corpora:
|
||||
the over-reach was nearly the whole raw-html cost in APIM policy XML and nearly none
|
||||
of it in vendor documentation, where what remains is real HTML — `<a>` 298, `<frame>`
|
||||
94, `<img>` 63 — caught correctly by the name branch.
|
||||
|
||||
**The two classes had to be measured together.** Alone they free 3 and 13 documents
|
||||
in reference-corpus; together, 25. A document carrying one usually carries the other,
|
||||
so closing either alone leaves it blocked by its twin. `docs/rawhtml-census.py` now
|
||||
carries a `PRODUCTION` row that re-measures the shipped predicate instead of a
|
||||
hypothetical, so a doc number and the code cannot drift apart unnoticed.
|
||||
|
||||
### Known behaviour change
|
||||
|
||||
**Documents whose only finding was one of these two classes now persist unattended.**
|
||||
On `PRESET_USER_UPLOAD` they move from `fail_secure` / `quarantine_review` to `WARN`
|
||||
— 25 documents in the reference corpus, 2 in each wiki corpus. This is a deliberate
|
||||
loosening of the *upload door*, not of detection: recall is unchanged at 128/128
|
||||
demonstrated classes with 6/6 documented gaps holding, and a tag that is active by
|
||||
name, carries an `on*=` handler, or points anywhere external is graded exactly as
|
||||
before. An element outside the active name set whose only URL attribute is
|
||||
doc-relative is the whole of what changed.
|
||||
|
||||
### Fixed — the scanner and the mutator no longer share one predicate
|
||||
|
||||
`neutralize` imported `is_active_tag` from `active_content` by name, so narrowing the
|
||||
scanner would have silently narrowed the opt-in mutator as well — and **no test in
|
||||
the suite discriminated the two halves**: every `neutralize:raw-html` payload stayed
|
||||
active under each narrowing considered. The predicates are now separate symbols,
|
||||
`is_active_tag` (scanner, external-target rule) and `is_defangable_tag` (mutator,
|
||||
unchanged broad behaviour), and the mutator half is pinned by its own test. Over-
|
||||
defanging costs nothing there — `neutralize` is opt-in and blocks no disposition —
|
||||
while under-defanging would hand a human a live construct.
|
||||
|
||||
### Self-safety (OWASP LLM10)
|
||||
|
||||
Reading a URL attribute's *value* needs a pattern the presence test does not provide.
|
||||
It reuses the same literal alternation with the value attached, so no new run shape
|
||||
enters the table, and `_REDOS_PAYLOADS` gains a row (`active-url-attr-value`) whose
|
||||
unit **denies** the `=` the pattern requires — a unit supplying it matches at once and
|
||||
never exercises the run. Measured at 100_000 chars: 0.031–0.046s across five attack
|
||||
shapes, against the suite's 2.0s bound. A gap between the two patterns fails secure:
|
||||
an attribute seen by the presence test but unreadable by the value parser counts as
|
||||
external, so it over-blocks rather than under-blocks.
|
||||
|
||||
727 tests pass (was 717).
|
||||
|
||||
|
||||
## [0.5.0] — 2026-08-11
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue