Skip to content

Hardening + CSP correctness, SARIF output, Report-Only detection (1.2.0) - #6

Merged
stevenkop-g merged 7 commits into
mainfrom
feat/hardening-and-csp-fixes
Jul 12, 2026
Merged

Hardening + CSP correctness, SARIF output, Report-Only detection (1.2.0)#6
stevenkop-g merged 7 commits into
mainfrom
feat/hardening-and-csp-fixes

Conversation

@stevenkop-g

Copy link
Copy Markdown
Contributor

Summary

Supply-chain/packaging hardening plus CSP-grading correctness fixes and two new features. Releases 1.2.0.

Tier 1 — hardening

  • npm provenance on publish (id-token: write + --provenance)
  • conditional exports map (keeps main/types for back-compat)
  • prepublishOnly now runs lint && test && build
  • non-blocking npm audit --audit-level=high step in CI
  • README: npm/CI/license badges + a "how this differs from securityheaders.com" section

Tier 2 — correctness

  • a directive set to 'none' is recognized as fully locked-down (never penalized)
  • frame-ancestors * / 'unsafe-inline' no longer wrongly earn the clickjacking bonus
  • nonce/hash sources ('nonce-…', 'sha256|384|512-…') are credited and suppress the browser-ignored 'unsafe-inline' penalty
  • fixed a stray quote in the CSP wildcard warning message

Tier 2 — features

  • new Content-Security-Policy-Report-Only analyzer (informational; warns when it is the only CSP)
  • SARIF 2.1.0 output via --format sarif for GitHub code-scanning / CI ingestion
  • detectWaf now exported from the entry point

Tests

New coverage for set-cookie, cache-control, coep, corp, csp (none/frame-ancestors/nonce), csp-report-only, and SARIF. 119/119 passing, tsc --noEmit + build clean.

🤖 Generated with Claude Code

stevenkop-g and others added 7 commits July 12, 2026 10:50
- publish.yml: add id-token:write permission and --provenance flag for npm provenance attestation
- package.json: add conditional exports map (keep main/types for back-compat); run lint + test + build in prepublishOnly
- ci.yml: add non-blocking npm audit --audit-level=high step
- README: add npm/CI/license badges and a "How this differs from securityheaders.com" section

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Treat a directive of exactly 'none' as safe (blocks everything) instead
  of penalizing it as dangerous or missing.
- Only reward frame-ancestors when it is a real allowlist / 'self' / 'none';
  a wildcard or 'unsafe-inline' now earns no bonus and is flagged as weak.
- Recognize 'nonce-...' and 'sha256/384/512-...' source expressions in
  script-src/style-src: credit them as a secure inline mechanism and stop
  penalizing the inert 'unsafe-inline' backwards-compat fallback beside them.
- Fix a stray quote in the wildcard warning message.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an analyzer that flags report-only mode, which monitors violations but
does not enforce the policy. It emits a warning when report-only is the only
CSP present, and a purely informational finding (never punishing) when a real
enforcing Content-Security-Policy also exists. The check has maxScore 0 so it
never moves the grade. Wired into the header registry and checker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add formatSarif() emitting valid SARIF 2.1.0 (one run, one rule per header
  check, results for failing/warning/noteworthy headers mapped to
  error/warning/note, plus information-disclosure notes). Register it in the
  formatters barrel and accept `--format sarif` in the CLI.
- Add `sarif` to the OutputFormat type and CLI VALID_FORMATS / help / README.
- Export detectWaf (and the WafDetection type) from the package entry point.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the missing Tier 2 test files for existing analyzers:
- set-cookie: Secure/HttpOnly/SameSite present and absent, SameSite=None
  without Secure, and the localhost exemption.
- cache-control: no-store, private/no-cache, private, public, and unclear.
- coep: require-corp, credentialless, unsafe-none, missing, unexpected.
- corp: same-origin, same-site, cross-origin, missing, unexpected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump version and document the hardening + feature changes in this branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stevenkop-g
stevenkop-g merged commit 74b2298 into main Jul 12, 2026
3 checks passed
@stevenkop-g
stevenkop-g deleted the feat/hardening-and-csp-fixes branch July 12, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant