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

Merging existing script-src incorrectly, missing a space. #72

Closed
rbliss opened this issue Mar 11, 2024 · 5 comments
Closed

Merging existing script-src incorrectly, missing a space. #72

rbliss opened this issue Mar 11, 2024 · 5 comments
Assignees

Comments

@rbliss
Copy link

rbliss commented Mar 11, 2024

Thanks for creating this plugin. We've been testing it out and ran into an issue. We have a CSP header set in our netlify.toml.

[[headers]]
  for = "/*"
  [headers.values]
     Content-Security-Policy = "img-src 'self' blob: data:; upgrade-insecure-requests; script-src  'sha256-test'"

When we include the plugin and deploy, the function appears to incorrectly merge the CSP header betweem the toml file and the rules generated by this plugin:

Content-Security-Policy: img-src 'self' blob: data:; upgrade-insecure-requests; script-src 'nonce-Z+TiRQyN2vWLRggZNdtCWfIc7NxH6PuW' 'strict-dynamic' 'unsafe-inline' 'self' https: http:'sha256-test'; report-uri /.netlify/functions/__csp-violations

It appears the merged content for script-src is missing a space between http and the original CSP string: http:'sha256-test' which causes the CSP to break for script src.

@jasonbarry jasonbarry self-assigned this Mar 11, 2024
@jasonbarry
Copy link

Thanks for reporting @rbliss! Will investigate shortly

@rbliss
Copy link
Author

rbliss commented Mar 11, 2024

Much appreciated @jasonbarry. Let me know if I can provide any further details to help.

@jasonbarry
Copy link

@rbliss we just released version 1.2.8 which should fix this problem -- can you upgrade and confirm if it fixes it for you? thanks!

@rbliss
Copy link
Author

rbliss commented Mar 11, 2024

@jasonbarry confirmed fixed. Thanks for the quick turnaround.

@jasonbarry
Copy link

@rbliss Sure thing! Thanks for reporting. Going to close this out

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

No branches or pull requests

2 participants