Repository navigation
fix(browser): normalize Referrer-Policy fallback lists - #814
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: Rudy Celekli <[email protected]>
N0zoM1z0
left a comment
There was a problem hiding this comment.
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.
|
Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @rudycelekli for the fix and the thorough verification — much appreciated! |
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-origincurrently yieldsreferrer_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
docs/product-catalog.json), package, or installation impact: none.Evidence and regression coverage
referrer_policy: "strict-origin-when-cross-origin".For evidence-bearing changes:
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.Two initial test-table type-inference failures retained; explicit tuple typing fixed them without changing production behavior or assertions.
Compatibility, safety, and release
Review checklist
type(scope): outcome.