-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Labels
angular/build:applicationarea: @angular/buildfeatureIssue that requests a new featureIssue that requests a new featurefeature: votes requiredFeature request which is currently still in the voting phaseFeature request which is currently still in the voting phase
Description
Which @angular/* package(s) are relevant/related to the feature request?
No response
Description
Currently CSP and SPAs don't work well together.
There is however something very simple we could do to make CSP 100% compatible with SPA.
Proposed solution
When Angular builds the app, also output a file called hashes.json. This file contains a list of hashes of all of the bootstrap js scripts. Then, in your backend, say asp.net core, you read this file and add the hashes to your CSP header.
This would be a very simple change that would make a lot of people's lives much easier.
Alternatives considered
- AutoCSP is not ideal because it uses the meta tag, not http headers.
- Setting the nonce to CSP_NONCE doesn't work with strict-dynamic.
- Setting the nonce in index.html breaks caching.
Metadata
Metadata
Assignees
Labels
angular/build:applicationarea: @angular/buildfeatureIssue that requests a new featureIssue that requests a new featurefeature: votes requiredFeature request which is currently still in the voting phaseFeature request which is currently still in the voting phase