feat(enrichment): flag insecure HTTP security-header settings in iac-misconfig - #3387
Conversation
…misconfig Extend the iac-misconfig analyzer with three HTTP security-header rules that fire on the config files it already scans (nginx/Apache/Caddy conf, Helm ingress annotations, netlify.toml, JSON headers): - hsts-disabled: Strict-Transport-Security with max-age=0 (browsers stop enforcing HTTPS for the host) - referrer-policy-leak: Referrer-Policy: unsafe-url (leaks the full URL, path and query, cross-origin) - cookie-not-httponly: httpOnly: false on a cookie (readable by JavaScript, so an XSS can steal it) Each rule requires its own header token on the same line as the weakening value, so an unrelated line that merely carries the value (a normal Cache-Control: max-age=0 caching directive) is never flagged; a table test asserts one finding per insecure setting and a negative test asserts the secure counterpart of each produces none. No existing rule, threshold, or analyzer descriptor changes, so analyzer-metadata.json is unaffected.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 05:55:01 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Add two zero-FP HTTP isolation header rules on the existing iac-misconfig analyzer, following #3387. Drops the X-XSS-Protection and X-Frame-Options ALLOWALL rules from the closed #3538 attempt per review feedback. Co-authored-by: luciferlive112116 <291889058+luciferlive112116@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
The IaC-misconfig analyzer already covers Kubernetes, Dockerfile, Docker Compose, and TLS-bypass
misconfigurations. This adds 3 HTTP security-header rules for insecure header values that appear in the
config files the analyzer already scans (
nginx*.conf,.conf, YAML/Helm ingress annotations,.toml,.json):hsts-disabledStrict-Transport-Security … max-age=0referrer-policy-leakReferrer-Policy: unsafe-urlcookie-not-httponlyhttpOnly: falseWhy these are false-positive-safe: each rule requires its own header token on the same line as the
weakening value, so an unrelated line that merely contains the value is not flagged: a normal
Cache-Control: max-age=0caching directive does not fire the HSTS rule (asserted in the negative test).Within a header that IS being set, the matched value is the weakening itself — the secure value uses a
different token the regex never matches (
max-age=31536000,strict-origin-when-cross-origin,httpOnly: true), also asserted to produce no finding. Each header token (Strict-Transport-Security,Referrer-Policy,httpOnly) has no report-only/prefixed variant that changes its enforcement meaning, sothe anchor is unambiguous.
No existing rule is modified, and the analyzer's finding schema is
{file, line, kind}— thekindunion isnot part of the analyzer descriptor, so
analyzer-metadata.jsonand the generated UI mirror are unchanged.The render-brief switch is TypeScript-exhaustive, so each new kind is compiler-forced to have a public-safe
explanation.
No linked issue: additive detection-coverage that extends an existing multi-domain analyzer along its own
established lines; each rule is a self-evident, named HTTP-hardening check (OWASP Secure Headers) with no public
API/schema/deploy surface change — fits the repo's
preferred(not required) linked-issue policy.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typechecknpm run rees:test— the review-enrichment build + analyzer suite (see note below)npm run test:coverage(N/A — this analyzer is inreview-enrichment/, outside the rootsrc/**Codecov scope)npm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
git diff --check(clean), the review-enrichment TypeScript build (exit 0 — which proves therender switch is exhaustive over the 3 new kinds), and the analyzer suite via
node --test. Theiac-misconfig file passes 21/21: a table test asserting each of the 3 settings produces exactly one finding
of its own kind, and a negative test asserting the secure counterpart of each — including a normal
Cache-Control: max-age=0(which must NOT fire the HSTS rule) — produces none. The fullnode --testrun'sonly failures are the two
upload-sourcemapstests (they shell out to the Sentry CLI, absent on this devbox), which fail identically on unmodified
main.metadata:checkstep ofrees:test. This change adds onlyfinding kinds and rules, not any analyzer descriptor field, so the committed
analyzer-metadata.json/ UImirror are unchanged (a local regeneration produces a zero-content diff) and
metadata:checkpasses on CI(Linux). On this Windows dev box
metadata:checkreports a spurious line-ending difference; it failsidentically on unmodified
main.analyzer-metadata.jsonwas NOT modified.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.Notes
threshold, or descriptor changed, so current findings and
analyzer-metadata.jsonare unaffected. Each newkind reports only
file:line+ the public-safe kind, never the matched line content.same value (e.g.
Cache-Control: max-age=0) is never flagged.