The referrer policy sends the full URL of pages to other sites, also over plain HTTP
What it finds
The Referer header tells the next site where a user came from. With the policies unsafe-url and no-referrer-when-downgrade, the full URL is sent to every other site, with any tokens or personal data in its path and query.
Reported are these policies given to helmet.referrerPolicy, to helmet as referrerPolicy, or set as the Referrer-Policy header.
From the rule's source, unsafe_referrer_policy.rs.
declare const helmet: any;declare const res: any;export const policy = helmet.referrerPolicy({ policy: "unsafe-url" });tx0 reports: this referrer policy sends full URLsres.setHeader("Referrer-Policy", "no-referrer-when-downgrade");tx0 reports: this referrer policy sends full URLsexport const safe = helmet.referrerPolicy({ policy: "same-origin" }); Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:unsafe-referrer-policy" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:unsafe-referrer-policy] reason="..."tx0 explain tx0/ts:unsafe-referrer-policy shows the same in the terminal. Found a false positive? Report it.