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

Content Security Policy #2296

Open
5 tasks
richardebeling opened this issue Oct 3, 2024 · 0 comments
Open
5 tasks

Content Security Policy #2296

richardebeling opened this issue Oct 3, 2024 · 0 comments
Labels
[C] Frontend Focuses on frontend implementation [P] Minor Minor priority [T] Refactoring Existing parts should become faster, more readable, or in any other way better.

Comments

@richardebeling
Copy link
Member

richardebeling commented Oct 3, 2024

See #2099.

  • Add django-csp
  • All html script tags should be annotated with a nonce (nonce="{{ CSP_NONCE }}"), then we can enforce nonces for scripts. For template tags, we probably have to manually forward the context . CSP Configuration should then look something like this.
  • To fix CSS, we need to figure out how we can handle dynamically generated colors. Using attr() in CSS doesn't work with current browsers, at least for colors. The only workaround I currently see is having custom javascript that translates data-X helper attributes for color into "inline" style (using the .style attribute) -- seems a bit ugly to me
  • To fix images, we'd need to move the data: images we currently have (3 svg paths in CSS files) into separate files. These are currently inlined into CSS to use our color definitions.
  • Consider setting up CSP failure reporting, maybe using some external service that tracks / aggregates them for us? Would leak user data though. mozilla-django-csp at least had a report-view in the past, but the documentation looks they don't want to maintain that anymore
@richardebeling richardebeling added [C] Frontend Focuses on frontend implementation [T] Refactoring Existing parts should become faster, more readable, or in any other way better. labels Oct 3, 2024
@janno42 janno42 added the [P] Minor Minor priority label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Frontend Focuses on frontend implementation [P] Minor Minor priority [T] Refactoring Existing parts should become faster, more readable, or in any other way better.
Development

No branches or pull requests

2 participants