← Back to Pull requests

fix(guard-vectors): measure C2.through-302/307 arrival on guards that refuse addScript #350

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 19, 2026 22:38 UTC
Author

Fixes #348.

What changes

C2.through-302 and C2.through-307:

  • protectedHop and landed are fixture request-log observations (served, observer fixture). Their dependsOn changes from [refused.3, refused.4] (Page.addScriptToEvaluateOnNewDocument, Page.setBypassCSP) to []. allowedBeacon, afterBeacon and detached stay tied to addScript.

  • New chainStarted: the stand-in served the chain's first hop, {ordinary}/hop?code=301 (served: /hop, origin {ordinary}, observer fixture, dependsOn: []). Expected true on the control and on the guarded leg.

  • The trigger settle already has or: {served: {cross}/doc?n={tag}-after, observer: fixture}. When addScript is refused, settle() does not skip it: refused() && !alt is false, so arrived() polls this.check(alt) and the leg waits for the landing before it observes. A mutant shows this: a leak whose protected hop arrives 700 ms late still fails, and the same mutant passes the leak once the or is removed.
  • Runner rules (guard-runner.mjs, for the CDP owner)

    1. Premise observations. const premises = { chainStarted: 'first hop not observed' }. In observeAll, an observation named in premises that has no dependsOn, is expected true on the leg, and whose check comes back false becomes incomplete with the reason chainStarted: first hop not observed. It never becomes false or a pass.
    - The rule does not apply when the leg expects false or "either", or to any other observation name.
    - Why: chainStarted is the row's premise. If the first hop never happened, protectedHop: false and landed: false on the guarded leg prove nothing. A plain expected-true mismatch would report fail, but this is missing evidence, so it is incomplete.
    - It is keyed by name on purpose. No other dependsOn: [] observation that expects true (C2.chain hopped, C3 committed/navigatedLater, X1 served, ...) moves from fail to incomplete.
    2. A control that measured nothing. On the control leg, if every observation was skipped and at least one was excused by a refused step in its dependsOn, the leg records measured nothing. The row then shows incomplete: control measured nothing.
    - Observations gated out as not-supported, or already incomplete through a dependency, count as unmeasured. They do not trigger the rule on their own.
    - A control that would have passed becomes incomplete. A control that fails stays fail. The guarded leg is unchanged.
    - This is the generic guard rail the owner approved.

    No schema, Go, Rust or README change: chainStarted is an ordinary observation name.

    Mutants (test/integration/guard-redirect-through.test.mjs, browser-free)

    A fake CDP client in the style of guard-incomplete/redirect-history-fixture. It is opt-in per test through cut/delay options. Every guard in this file refuses Page.addScriptToEvaluateOnNewDocument. Each test runs on both through-302 and through-307, target seven:

    | mutant | control | guarded |
    |---|---|---|
    | lets the chain through the protected hop | pass; control measures chainStarted/protectedHop/landed true | fail (protectedHop, landed true) |
    | leaks, with the protected hop 700 ms late | pass | fail (the settle or waited) |
    | cuts at the protected hop | pass | pass |
    | cuts the first hop of a chain to a protected origin (chain never starts) | pass | incomplete: guarded chainStarted: first hop not observed; summary not a pass |
    | same row with every observation made dependent on refused.3 | incomplete: control measured nothing; summary not a pass | pass (excused) |

    Every control assertion also checks that allowedBeacon, afterBeacon and detached stay excused. All 10 tests fail on origin/main: they were copied into a clean git archive tree and run there.

    Audit: fixture-only observations with refused dependencies (C1–C5, E)

    "Fixture-only" means every leaf of the check has observer fixture, with no client or unguarded leg.

    Fixed:

    | row | observation | dependsOn (before) | why not needed |
    |---|---|---|---|
    | C2.through-302 | protectedHop | refused.3 addScript, refused.4 setBypassCSP | The stand-in's request log records the /hop request at {target} whether or not an init script or CSP bypass is installed. |
    | C2.through-302 | landed | refused.3, refused.4 | Same: the {cross}/doc?n={tag}-after request is logged by the stand-in. |
    | C2.through-307 | protectedHop | refused.3, refused.4 | same as through-302 |
    | C2.through-307 | landed | refused.3, refused.4 | same as through-302 |

    No other request-log (served/hops/loaded/pre) observation in C1–C5 or E has a non-empty dependsOn. Every other fixture-only observation with a dependency is a beacon or a header, and in each case the dependency is the step that produces it:

  • Beacons: allowedBeacon/beacon/pageBeacon/afterBeacon in C1.script-nav, C1.href/replace/form, C2.chain-, C2.post-, C2.through-, C2.302/307/twohop, C3.popup, C3.popup-self-nav, C3.popup-on-redirect-, C4.-site, C4.iframe, E1.onload, E2.binding and E5.console. They depend on the addScript or addScriptToEvaluateOnLoad step that installs the beacon. For child targets they also depend on Target.setAutoAttach.

  • Headers: E6.headers(.iframe) header depends on Network.setExtraHTTPHeaders. E6.ua-network(.iframe) agent depends on Network.setUserAgentOverride, E6.ua-emulation(.iframe) agent on Emulation.setUserAgentOverride, and E6.cache-disabled(.iframe) uncached on Network.setCacheDisabled.
  • Not changed (for the owner):

    | row | observation | dependsOn | reason |
    |---|---|---|---|
    | C4.static-cross-site, C4.script-cross-site | beacon | refused.3 page addScript, refused.7 child addScript, refused.8 setAutoAttach | The {target} beacon can come from the child's init script (OOPIF) or from the page's (in-process frame). Refusing only refused.3 excuses an observation the child script could still measure. Which script fires depends on the process model, so this is a design call. It is a beacon row, so it is not touched here. |
    | C5.guessed-id.continue-response | candidates, refused, answered, overridden | refused.2 Fetch.enable | These are client observations, not fixture-only. They are listed on request. refused.2 is onlyProtected, so a guard that refuses Fetch.enable wholesale already fails its control ("a protected-only step was refused on the control"). Owner decision: this stays the design. No declared field and no schema change. |
    | B2.headers, X1.after-exit (outside C1–C5/E) | header; instrumented/headed | refused.3 setExtraHTTPHeaders; initScript/extraHeaders | The dependency is the step that produces the header or beacon, so it is needed. |

    Consumer effect

  • C2.through-302 / C2.through-307 (targets seven, vault, vault-x, apex; own is not-applicable), on a guard that refuses addScript or Page.setBypassCSP (either one used to excuse protectedHop and landed):

  • - It leaks the redirect-through: guarded pass → fail (intended).
    - It blocks at the protected hop: stays pass.
    - The first hop at the ordinary origin is never served (cut at the ordinary hop, or the href never navigates): pass → incomplete.
    - On the control leg, the ordinary-origin chain is now measured. A control that never lands on {cross} goes pass → fail, and one whose chain never starts goes pass → incomplete.
  • No other row can flip for the same reason: the audit found no other request-log observation tied to a refused step.

  • Guards that accept both addScript and setBypassCSP, including the no-guard sweep, see chainStarted: true and no change.

  • "Control measured nothing" changes no row with these vectors. Statically, only two rows have every observation behind a refusal, and both controls already fail when that step is refused:

  • - C5.guessed-id.continue-response (onlyProtected Fetch.enable).
    - C8.browser-ui-listed (a via: unguarded control, which fails on any refusal).
    - Without this PR's dependsOn change, the invariant would have flipped C2.through-302/307 to incomplete.

    Impact on the guards' reports

    A throwaway script, not in the repo, read each per-row report as JSON only. It lists the rows whose control passed with every observation excused, under origin/main vectors and under this PR's vectors. It also lists the observations that were excused in the report and are measured with this PR's vectors.

    slicc-cdp, run 44609779996 (guard c40e5b64, slicc-browsers 1.28.1; guard-a..d, 964 rows):

  • Control measured nothing, with this PR's vectors: 0 rows.

  • With the base vectors (the invariant alone) it would have been 16 rows: C2.through-302 and C2.through-307 × {seven (a), vault (b), vault-x (c), apex (d)} × {prompt, lagging}. All are control pass / guarded pass / live pass, with refused.3: true, refused.4: true on both legs.

  • Now measured: those same 16 rows, chainStarted, protectedHop and landed on both legs. Their verdict under this head needs a slicc-cdp run. Today they pass with nothing measured.

  • C5.guessed-id.continue-response: refused.2: false, every observation measured, pass/pass/pass on all four targets. No change.
  • slicc-cdp, run 44620930162 (draft runCapabilities change c1eca024, autoAttach undeclared; guard-a..d): the same as above. 0 rows with this PR's vectors. The same 16 through rows would have been flipped by the invariant alone and are now measured.

    slicc-cli, diagnostic runs (no per-row artifact yet), prompt and lagging, SETTLEDIAG:

  • Each run has 38 rows with settle:skipped-refused on both legs, all pass/pass/pass: C1.script-nav ×5; C2.chain-301-302-303, C2.chain-307-308-302, C2.chain-303-301-308, C2.post-307-308 and C2.post-308-307 ×4 each; C2.through-302 and C2.through-307 ×4 each; C3.popup-self-nav ×5.

  • The 30 rows other than C2.through keep an always-measured observation (loaded, plus hopped for chain/post, both dependsOn: []), so the invariant leaves them unchanged.

  • The 8 through rows were the only ones measuring nothing. They now measure chainStarted/protectedHop/landed.

  • Two more SETTLEDIAG lines (C3.tab-attach) are settle errors, not refusals.

  • The diagnostic lines carry no refused. values. To be refined when the per-row artifact arrives.
  • bios: pending a per-row artifact.

    Checks run locally

  • npm ci, npm run validate, npm run lint.

  • Browser-free tests only, no Chrome: this file; the fake-client guard tests (bfcache, browser-ui, close-protected, credential-export, error-page-, exit-, extension-frame-cast/mouse, forged, frame-read, incomplete, redirect-carrier/history/iframe/session-end, reveal-overlap, snapshot-settle, stall, trusted-emulation, unparseable-wipe, validation, world-paint); and workflows (485 tests, all pass).

  • The Chrome-backed suites, including the sweeps, run in CI only.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: chatgpt-codex-connector[bot] Review duration: 3m
    All Vouch review confidence checks passed
    Residual risk 0.43 = Change Risk (0.52) × (1 − Review Confidence (0.18)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 18% · Reviewer familiarity: 35%
    17%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #350"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 17.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 17.7% · Lower = rushed or shallow review
    17.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 42.8% · Moderate risk
    42.8%