GREATUK-1191 Implement 2024 penetration test recommendation #3649
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.
What
2024 penetration test recommendation suggest we update the content security policy to prevent inline javascripts from executing
Why
The CSP specification2 states that developers should not use as it enables XSS attacks by allowing code to be included directly into the document.3 Furthermore, the usage of should also be disallowed, since eval is considered a bad practice, opening up the possibility of code injection.
Furthermore, several third party domains were allowlisted within the policy. Every allowisted domain undermines the CSP and potentially allows for exploitation of XSS vulnerabilities which would otherwise not have been exploitable. In particular, several allowlisted domains ( and ) were known to allow various CSP bypasses.4 5 6
Recommendation
Review the CSP’s configuration to implement the best practices as described by the specification.7 8 9 10
Content Security Policy Specification: Content Security Policy Level 3
The unsafe-inline Source List Keyword unsafe-inline ⟶ CSP Guide
Workflow
Reviewing help
Merging