-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Content Security Policy and SPAs #32405
Copy link
Copy link
Open
Labels
angular/build:applicationarea: @angular/buildfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: votes requiredFeature request which is currently still in the voting phaseFeature request which is currently still in the voting phase
Metadata
Metadata
Assignees
Labels
angular/build:applicationarea: @angular/buildfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: votes requiredFeature request which is currently still in the voting phaseFeature request which is currently still in the voting phase
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