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
Tighten up Content-Security-Policy #1513
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
davidmehren
added
the
type: feature enhancement
An improvement to existing functionality
label
Aug 6, 2021
SISheogorath
requested changes
Aug 6, 2021
SISheogorath
approved these changes
Aug 8, 2021
Now with green tests! |
InnayTool
reviewed
Aug 8, 2021
ErikMichelson
requested changes
Aug 9, 2021
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.
This tightening breaks slideshare on Chrome.
jquery.js:10185 Refused to load the script 'http://www.slideshare.net/api/oembed/2?url=http://www.slideshare.net/briansolis/26-disruptive-technology-trends-2016-2018-56796196&format=json&callback=jQuery36008752817940203228_1628541591964&_=1628541591965' because it violates the following Content Security Policy directive: "script-src http://localhost:3000/build/ http://localhost:3000/js/ http://localhost:3000/config https://gist.github.com/ https://vimeo.com/api/oembed.json https://www.slideshare.net/api/oembed/2 'unsafe-inline' 'nonce-c14f1eb8-61a0-47e5-a4f1-5d41be287756' 'sha256-81acLZNZISnyGYZrSuoYhpzwDTTxi7vC1YM4uNxqWaM='". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
InnayTool
approved these changes
Aug 14, 2021
This commit changes the - default-src to none, so everything is disallowed by default - base-uri, connect-uri and font-src to self, so these are restricted to the current origin - frame-src to allow SlideShare, Vimeo and YouTube - script-src to the specific paths that are used by HedgeDoc to serve scripts. This explicitly does not include the /uploads route - style-src to the specific paths that are used by HedgeDoc to serve styles - Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Reveal.js styles are hosted there Signed-off-by: David Mehren <git@herrmehren.de>
The reveal.js speaker view uses frames to display the slides Signed-off-by: David Mehren <git@herrmehren.de>
Chrome complains otherwise, as it can't download the Web Manifest. Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
In 25f5fd2 the `media-src`, `child-src` and `connect-src` settings were removed, as they are filled with the `default-src` automatically. This caused a bug in the test code, as it now tried to access a nonexistent field of `unextendedCSP`. This commit adds a filter that removes the empty array field before converting to a string. Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Signed-off-by: David Mehren <git@herrmehren.de>
Otherwise, `video` tags and reveal background video does not work Signed-off-by: David Mehren <git@herrmehren.de>
ErikMichelson
approved these changes
Aug 14, 2021
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.
Component/Part
Content Security Policy
Description
This PR
default-src
tonone
and then only allowing things explicitly.When both options are disabled, CSP Scanner is pretty happy and gives us an
A
scoreBy default, both options are enabled for backwards-compatibility, CSP Scanner gives us a B
Steps
made sure that:
master
for 1.x & docs,develop
for 2.xRelated Issue(s)