Skip to content
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

Don't use nonces in Content-Security-Policy, use hashes. #4464

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martinemde
Copy link
Member

This adds a concern that provides the inline_script and inline_script_content interface which allows us to declare and then render inline scripts in a way that is compatible with computing hashes.

The nonce is not ideal because it gets cached by Fastly, with each page caching a different nonce based on the user requests that happened to be cached. Not very nonce-y.

This also remove the nonce hack that caused some session generation problems originally, even though they are fixed now.

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (89b2171) 97.13% compared to head (9855722) 96.87%.

Files Patch % Lines
app/controllers/concerns/inline_scripts.rb 94.44% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4464      +/-   ##
==========================================
- Coverage   97.13%   96.87%   -0.26%     
==========================================
  Files         385      386       +1     
  Lines        8200     8236      +36     
==========================================
+ Hits         7965     7979      +14     
- Misses        235      257      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martinemde
Copy link
Member Author

The avo inline script needs to be updated to fix the tests.

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.

None yet

1 participant