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
The 'strict-dynamic' source expression specifies that the trust explicitly given to a script present in the markup, by accompanying it with a nonce or a hash, shall be propagated to all the scripts loaded by that root script. At the same time, any allowlist or source expressions such as 'self' or 'unsafe-inline' will be ignored.
Based on that documentation I would expect both cases to work. For the esbuild case, we are allowing main.js via sha384, which should then be allowed to import further scripts. Is there something I am missing here?
Refused to load the script '.../chunk-123.js' because it violates the following Content Security Policy directive:"script-src ... 'sha384-123' 'strict-dynamic'".Note that 'strict-dynamic' is present, so host-based allowlisting is disabled.Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Exception or Error
No response
Your Environment
17.3
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered:
This sounds like a browser issue, I'm not sure there's anything actionable for Angular here. AFAICT, the hashes are generated correctly, it's just that strict-dynamic is broken for this particular scenario in Chrome and Firefox. I'd recommend filing issues against those two vendors if they don't already exist and avoiding strict-dynamic until that gets resolved.
If there's something we're generating incorrectly, then we can take a look at fixing that within Angular. But otherwise this seems like more of a problem with those browsers.
Command
build
Is this a regression?
The previous version in which this bug was not present was
@angular-devkit/build-angular:browser
Description
This is a follow up to #26330 and appreciate the work on adding the
preloadInitial
flag.It seems like the real issue is the way chunks are loaded by esbuild (screenshots below):
runtime.js
file that loads scripts in a way that worked withstrict-dynamic
import ... from "chunk.js";
directly frommain.js
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#strict-dynamic
Based on that documentation I would expect both cases to work. For the esbuild case, we are allowing
main.js
via sha384, which should then be allowed to import further scripts. Is there something I am missing here?Minimal Reproduction
@angular-devkit/build-angular:browser
outputChrome trace for loading the first chunk
@angular-devkit/build-angular:application
outputChrome trace for loading the first chunk
Chrome console error
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: