Enable Content Security Policy for AWBW#1491
Draft
lenikadali wants to merge 1 commit intomainfrom
Draft
Conversation
Enables Content Security Policy for AWBW based on what we're already using in the codebase (the code is mostly vanilla Rails with minimal to no JavaScript) so much of the Rails defaults have removed.
Collaborator
Author
|
Some tests are broken; going to look into them and fix. For now, switching to draft. |
This file contains hidden or 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
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.
Closes #261
What is the goal of this PR and why is this important?
Enables Content Security Policy for AWBW based on what we're already using in the codebase.
The code is mostly vanilla Rails with minimal to no JavaScript so much of the Rails defaults have been removed.
We're adding this so that AWBW is not vulnerable to Cross-site scripting (XSS) attacks.
How did you approach the change?
I reviewed the issue, then read up on how Rails handles CSP configuration and compared the different options available to what the AWBW code is using. Important notes:
<%= csp_meta_tag %>is used when considering using'unsafe-inline'as per Rails guide here. Since we are not considering using'unsafe-inline'and it is not already used in the codebase, it has been omitted from the initial configuration.Anything else to add?
I could have left in the Vite/JavaScript lines but removing them keeps the file cleaner and easy to read for someone looking at it. Happy to restore the lines if there's a preference for preserving them 😄