Skip to content

fix(browser): normalize Referrer-Policy fallback lists - #814

Closed
rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/referrer-policy-fallback-lists-20261006
Closed

rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/referrer-policy-fallback-lists-20261006

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Preserve declared Referrer-Policy fallback lists in browser response metadata. This focused parser fix does not require a large-contract issue. AI assistance was used; I reviewed the changes and executed the checks.

Problem and expected behavior

no-referrer, strict-origin-when-cross-origin currently yields referrer_policy: null, although Chrome uses the last recognized policy. Unknown-only names instead appear recognized. The current W3 algorithm selects the last recognized nonempty policy.

Change and scope

Dedicated eight-policy normalization selects the last recognized token, skips empty/unknown names, normalizes mixed case and reports malformed syntax as null. Other policy-header parsers remain unchanged. This describes a response declaration, not effective document policy or browser defaults.

Contract and boundary impact

  • Semantic owner and earliest changed stage: CdpSafeMetadata response-header normalization.
  • CLI and MCP/tool-catalog contract: existing field, no schema/catalog change.
  • Provider, bridge, target-format, or platform compatibility: CDP; actual Chrome154.0.8037.94 tested.
  • Evidence, artifact, provenance, or reconstruction contract: recognized declaration retained; unknown remains null.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated:18 table cases, all eight policies, list order, unknown/missing/empty values, mixed case, empty entries, malformed input; other policy controls retained.
  • Base reproduction or other evidence:main472b72a gives6fail/17pass. Actual public inspectPage against owned dual-loopback HTTP servers loses three valid lists, independently verified using actual Chrome response headers and outgoing Referer.
  • User-visible CLI/MCP output:example now reports referrer_policy: "strict-origin-when-cross-origin".
  • Remaining proof gaps:no effective-policy/default inference, cross-browser matrix or request-override claim.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • node node_modules/vitest/vitest.mjs run tests/boundary/browser/cdpSafeMetadata.test.ts tests/boundary/browser/cdpBrowserProvider.sensitive_data.test.ts:28passed.
  • npm run check:five tasks passed;129existingwarnings/zero lint errors.
  • npm run check:fast:two tasks passed.
  • npm run docs:check, npm run build, npm run verify:browser:passed.
  • External actual Chrome/public CdpBrowserProvider fixture:eight cases passed, including three valid fallback lists, ordinary single policy, mixed case, empty entries, quoted malformed input and unknown-only input. Actual cross-origin requests independently confirm the observed behavior; no synthetic events.

Two initial test-table type-inference failures retained; explicit tuple typing fixed them without changing production behavior or assertions.

Compatibility, safety, and release

  • Breaking changes or migration steps:no schema/migration; unknown-only declarations now null instead of unknown string.
  • Real Hopper/Ghidra, browser, or OS coverage:actual local Chrome on macOS; no Hopper/Ghidra or browser/OS matrix claim.
  • Package or release metadata impact:none.
  • Security, privacy, process, or containment review:normalization only; admission/authority unchanged, raw headers remain discarded.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source review passed on heada4571028a8. Recognized fallback tokens select the last policy; unknown extension tokens stay ignored, empty entries are skipped, and malformed syntax stays unknown. The extension-token grammar is ALPHA/hyphen (https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header), so the parser restriction is intentional. Production build, all23 local metadata tests and six independent Chrome153 HTTP/Referer controls passed on a frozen checkout; all20 hosted checks are green. No blocking source finding. This currently has a test-only conflict with merged#805 in cdpSafeMetadata.test.ts. Update the branch and rerun relevant checks before merging; no conflict resolution performed here.

@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @rudycelekli for the fix and the thorough verification — much appreciated!

@morluto morluto closed this Oct 7, 2026
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants