A protective response header of helmet is turned off

tx0/ts:security-header-disabledrecommendedwarningsecurity, cwe-693

What it finds

The helmet middleware sets the response headers that make browsers enforce a content security policy, refuse framing by other sites, keep to HTTPS and not guess content types. Turning one of them off removes that protection for every response.

Reported are the options contentSecurityPolicy, frameguard, xFrameOptions, hsts, strictTransportSecurity, noSniff and xContentTypeOptions set to false in a call of helmet.

From the rule's source, security_header_disabled.rs.

Example from the rule's tests
import helmet from "helmet";export const a = helmet({ contentSecurityPolicy: false, hsts: true });tx0 reports: turning off contentSecurityPolicyexport const b = helmet({ frameguard: { action: "deny" } });
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:security-header-disabled" = "warning"

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:security-header-disabled] reason="..."

tx0 explain tx0/ts:security-header-disabled shows the same in the terminal. Found a false positive? Report it.