Skip to content

Fix CSP error - script-src directive #2521

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

Closed
wants to merge 1 commit into from

Conversation

yamafaktory
Copy link

Attempt to fix Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). presumably related to this commit 38758b3

cc/ @JohnTitor

Attempt to fix `Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).` presumably related to this commit rust-lang@38758b3
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sgrif (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@JohnTitor
Copy link
Member

Attempt to fix Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

Hm, where did you find that error? I couldn't see that on the top page.

@yamafaktory
Copy link
Author

@JohnTitor Sorry, this PR is definitely missing some context..

image

@yamafaktory
Copy link
Author

@JohnTitor Basically, this is when you reach the detail view of any given crate. Before the chart was loaded and displayed next to the download statistics.

@yamafaktory
Copy link
Author

Well, actually it's even visible on the top level, see this Chromium screenshot:
image

@JohnTitor
Copy link
Member

Uhm, indeed 38758b3 touched CSP directive but it isn't deployed to the production yet. And seems the inline error is coming from your browser extension(s) since your private window on Chrome doesn't complain (these errors are by external resources, to me) but Firefox does.

@yamafaktory
Copy link
Author

Ok, wasn't aware it was not deployed yet!

However, no matter if I open an incognito tab in Firefox or Chromium, I'm still getting the CSP error and the chart can be loaded and displayed.

See:
image
image

@yamafaktory
Copy link
Author

@JohnTitor so it might simply be that your commit will fix that issue when deployed to production 🚀 !

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it! So, this looks good to me :)

@yamafaktory
Copy link
Author

Thanks a ton @JohnTitor 🙇 !

@JohnTitor
Copy link
Member

r? @jtgeibel since this(unsafe-inline) will affect the security.

@rust-highfive rust-highfive assigned jtgeibel and unassigned sgrif May 21, 2020
@bors
Copy link
Contributor

bors commented May 23, 2020

☔ The latest upstream changes (presumably #2480) made this pull request unmergeable. Please resolve the merge conflicts.

@jtgeibel
Copy link
Member

Thanks for the PR @yamafaktory. I'm in the process of deploying the previous CSP changes and in staging they appear to resolve the CSP errors shown in the console. So fortunately it appears that adding unsafe-inline for script-src is unnecessary. That is good because I would worry that errors in README sanitation could lead to security issues if this was added.

Thanks again!

@jtgeibel jtgeibel closed this May 23, 2020
@yamafaktory
Copy link
Author

@jtgeibel cool! Thanks for the feedback!

@yamafaktory yamafaktory deleted the patch-1 branch May 23, 2020 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants