-
Notifications
You must be signed in to change notification settings - Fork 69
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
Content Security Policy Nonces Documentation doesn't mention where to import setNonce method from #1607
Comments
Just tested it locally. Looks good on my side: adding csp header: <meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'nonce-randomNonceGoesHere'; style-src 'self' 'nonce-randomNonceGoesHere'"
/> setNonce import { setNonce } from '@siemens/ix/loader';
import { setNonce as setNonceIcons } from '@siemens/ix-icons/loader';
const nonce = 'randomNonceGoesHere';
setNonce(nonce);
setNonceIcons(nonce); Did you forgot to configure the angular side? https://angular.dev/best-practices/security#content-security-policy e.g <app-root ngCspNonce="randomNonceGoesHere"></app-root> |
Configuring on angular should not matter in this case, as I would anyways get errors from angular. But even after configuring the angular side (which fixes the angular errors), I still get console errors from IX. |
For example this is a plain javascript example for IX, |
Also here you have in mind that you need to expose a nonce to vite because css import is handled as inline style.
|
Thanks for the workaround. And setTimeout thing works for javascript. Any idea how we could do it for Angular ( as we use IxModule directly) since it would be better to use setNonce rather than |
Prerequisites
What happened?
The CSP Nonces Docu from IX does not give a example of how to use it in an Angular application. The documention mentions to read official stencil documention which provides a setNonce method. However the IX documention does not mention where to import this setNonce method from. I have created a stackblitz example here making edits to index.html and main.ts. But I am still getting console erros coming from IX related to CSP. Am I missing something here ?
The text was updated successfully, but these errors were encountered: