forked from eclipse-edc/DataDashboard
-
Notifications
You must be signed in to change notification settings - Fork 15
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
build(docker): set standardized headers in NGINX #729
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Angular's implementation of style inlining adds an inline onload handler to the stylesheet <link> tag, which conflicts with CSP. There are workarounds of questionable reliability, but this actually works, at the cost of a slight load-time penalty.
Subresource integrity [1] is a feature in recent web browsers that allows annotating scripts, stylesheets, and others with an `integrity` attribute containing a hash of the contents. These hashes can then be used together with CSP to ensure only trusted scripts may be loaded. Enabling this Angular build option only emits the `integrity` attribute on generated <script> and <link> tags; setting a matching CSP header has to be done in the web server configuration. [1]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
Replace isomorphic-dompurify with DomSanitizer from @angular/platform-browser. This helps in supporting the `trusted-types` CSP directive, as it can be reduced to just Angular-related types with this. The removed portions about rel="noopener noreferrer" will be covered by the Cross-Origin-Opener-Policy and Referrer-Policy security headers.
Add a minimal script that can be used to generate valid CSP hashes from a list of input files passed on the command line.
Set the following headers: - Content-Security-Policy - Cross-Origin-Embedder-Policy - Cross-Origin-Opener-Policy - Cross-Origin-Resource-Policy - Origin-Agent-Cluster - Referrer-Policy - X-Content-Type-Options - X-Download-Options - X-Frame-Options - X-XSS-Protection Specifically, the combination of Cross-Origin-Opener-Policy and Referrer-Policy takes the role of setting `rel="noreferrer noopener"` on external links, which was removed in a prior commit replacing the HTML sanitizer used for Markdown rendering. * Generate hashes of JS files during the build process * Template hashes into CSP * Include headers in NGINX configuration
sybereal
force-pushed
the
build/docker-nginx-standard-headers
branch
from
April 16, 2024 15:10
5d57f65
to
6fe806d
Compare
richardtreier
approved these changes
Apr 16, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set a number of security headers on all responses from NGINX:
What issues does this PR close? N/A
Checklist