Skip to content

fix(csp): flag object-src wildcard as a high-risk misconfiguration#52

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/nice-mendel-7GFbM
Open

fix(csp): flag object-src wildcard as a high-risk misconfiguration#52
dmchaledev wants to merge 1 commit into
mainfrom
claude/nice-mendel-7GFbM

Conversation

@dmchaledev
Copy link
Copy Markdown
Contributor

Summary

  • object-src * allows unrestricted plugin content (Flash, Java, ActiveX) that can execute scripts and fully bypass CSP — it is listed in the CSP spec as one of the directives that must be restricted to prevent script injection.
  • Despite this, object-src was missing from the wildcardDirectives list in checkCSP, so a policy like default-src 'self'; script-src 'self'; object-src * silently scored 20/30 — a perfect CSP score — while leaving a critical gap.
  • Fix: add object-src to wildcardDirectives alongside script-src, connect-src, etc.

Repro (before fix)

checkCSP({ 'content-security-policy': "default-src 'self'; script-src 'self'; object-src *; form-action 'self'" })
// score: 20, findings: [] — ← false clean bill of health

After fix

// score: 15, findings: ["Wildcard (*) source in object-src allows any origin"]

Test plan

  • New test detects wildcard in object-src added to test/analyzer.test.ts
  • All 83 tests pass (npm test)
  • No behaviour change for policies that don't include an explicit object-src directive

https://claude.ai/code/session_01XNrf9CDh8K2SLvH7U5rPPs


Generated by Claude Code

object-src * allows unrestricted plugin content (Flash, Java, ActiveX)
that can execute scripts and bypass CSP. It was silently omitted from the
wildcard-directive check, so a policy like:

  default-src 'self'; script-src 'self'; object-src *

scored 20/30 — a perfect CSP score — despite the critical gap.

Adds object-src to wildcardDirectives and a matching test case.

https://claude.ai/code/session_01XNrf9CDh8K2SLvH7U5rPPs
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.

2 participants