You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security/csp: csp-wildcard fires on host wildcards like https://*.example.com #427
security/csp warns "CSP script-src allows wildcard (*) / Scripts can load from any domain" for any policy whose script-src has a host wildcard, such as https://*.posthog.com.
In packages/rules/src/security/csp.ts, WEAK_VALUES = ["*", "data:", "blob:", "'unsafe-inline'", "'unsafe-eval'"] is checked with scriptSrc.includes(v). That is a substring match on the whole directive value, so the * in *.posthog.com counts as a bare wildcard.
Expected
Only a bare * source token means "any host". Scheme-only sources (https:, http:, data:, blob:) are the other broad cases. https://*.example.com is scoped to one domain's subdomains and should not trigger csp-wildcard.
Fix
Split the directive value on whitespace and match source tokens exactly. Optionally report scheme-only https: / http: as their own "any host over this scheme" check.
Acceptance
script-src 'self' https://*.posthog.com → no csp-wildcard.
script-src * → csp-wildcard warn.
script-src 'self' https: → broad-scheme warn, if added.
Same tokenised matching for the other WEAK_VALUES. data: should not match metadata:-style substrings.
Context: found while checking why security/csp gave identical findings for a broken and a fixed policy (see #425 and #426).
Fixed in #438 (e4255c0): host wildcards like https://*.example.com no longer fire csp-wildcard; a bare * host still does.
Activity
fix(rules): match CSP script sources as whole tokens #427
fix(rules): noscript content, implicit ARIA roles and CSP host wildca…
nc9 commentedon Oct 1, 2026
Fixed in #438 (e4255c0): host wildcards like https://*.example.com no longer fire csp-wildcard; a bare * host still does.