-
Notifications
You must be signed in to change notification settings - Fork 267
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
unsafe-eval csp violation #1128
Comments
@hokiepokedad2 what |
Sorry about that. I forgot to enclose the tag in a codeblock. I've updated the description but here it is also:
|
I was able to repro the bug in our sample Angular app, however when I attempted to repro in a non-Angular (React) app I did not get the error or any other CSP violations. Seems like this might be a problem with Angular itself: |
Yes, we actually have 'unsafe-inline' set for style-src also. The meta tag I added above was just a quick and dirty rule. Even specifying 'unsafe-inline' for style-src, I get the 'unsafe-eval' violation:
If I remove all references of Okta Auth JS from our app, the violation is no longer reported. |
Internal Reference: OKTA-475241 |
Hi @jaredperreault-okta - have there been any thoughts intenlrnally on this? Fortunately we have a Middleware component in our dotnet app to block any type of script injections but this still prevents us from using our csp rules to instruct client browsers to block unsafe-eval scripts. For now, we have allowed unsafe-eval but would like to see if theres been any movements on this or if anyone else have observed this behavior? |
We do not have a fix for this quite yet, but we believe the issue involves bundle selection. It seems your app is pulling in the |
@hokiepokedad2 Our Inside the resolve: {
alias: {
// '@okta/okta-auth-js': path.resolve(__dirname, 'node_modules/@okta/okta-auth-js/dist/okta-auth-js.umd.js'),
'@okta/okta-auth-js': path.resolve(__dirname, 'node_modules/@okta/okta-auth-js/esm/index.js'),
}
}, This tells the Angular build process to specifically use the More Info: |
Describe the bug?
While attempting to harden our security policies on the client via CSP headers, we noticed the okta-uath-js.umd.js library is using unsafe-eval calls such as Function(). Here is a sample definition of our policy:
Notice that we are not using 'unsafe-eval'. Our client site is Angular 12.
What is expected to happen?
Website continues to render with no errors violation our csp policy.
What is the actual behavior?
okta-auth-js.umd.js:2
Reproduction Steps?
On a fresh angular app, or even a simple html page with a reference to the okta-auth-js library, specify the following meta tag in the head element:
Browse to the site and open the developer tools console. Take note of the error presented.
okta-auth-js.umd.js:2
SDK Versions
Execution Environment
MS Edge, Chrome Browsers
Windows 10/Server 2019
Visual Studio 2022 IIS Express or IIS/Kestrel hosting angular app
Additional Information?
No response
The text was updated successfully, but these errors were encountered: