Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presence of unsafe- directive in content security policy header. How do we remove that. #2738

Open
jaysara opened this issue May 15, 2024 · 0 comments

Comments

@jaysara
Copy link

jaysara commented May 15, 2024

The question
With our use of modernizr 2.6.2 version we have detected a security vulnerability pointing to presence of unsafe- directive in content security policy header.

As per the standards and compliant with CSP, ‘unsafe-‘ prefix directives should be removed from Content Security Policy header configuration. To meet the compliance with CSP we tried to remove the ‘unsafe-‘ prefix directives (‘unsafe-inline’ and ‘unsafe-eval’), it creates an issue rendering the Modernizr scripts/styles in application.

Remediation Step Followed:
Followed the remediation steps of adding a ‘nonce’ and ‘hash’ techniques, but we were failed to add or insert the nonce/hash to the Modernizr

Modernizr has the inline css

a.yepnope.injectCss = function(a, c, d, e, g, i) { var e = b.createElement("link"), j, c = i ? h : c || f; e.href = a, e.rel = "stylesheet", e.type = "text/css"; for (j in d) e.setAttribute(j, d[j]); g || (n.parentNode.insertBefore(e, n), m(c, 0)) } }(this, document), Modernizr.load = function()

Content Security Policy header has the ‘unsafe-’ prefix directive:

     ```
 Content-Security-Policy:

default-src 'self' stats.g.doubleclick.net *.google-analytics.com *.googletagmanager.com *.transunion.com; style-src 'self' *.google-analytics.com *.googletagmanager.com *.transunion.com 'unsafe-inline'; font-src


Following is the version info of Modernizr we are using Modernizr 2.6.2 (Custom Build) | MIT & BSD
Can you please help us with any settings that we can do in the Modernizr to remove this header from appearing.
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

No branches or pull requests

1 participant