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

Strengthen Content-Security-Policy header #1914

Open
4 tasks done
SineSwiper opened this issue Jul 11, 2023 · 1 comment
Open
4 tasks done

Strengthen Content-Security-Policy header #1914

SineSwiper opened this issue Jul 11, 2023 · 1 comment
Labels
area: security bug Something isn't working

Comments

@SineSwiper
Copy link

Requirements

  • This is a bug report, and if not, please post to https://lemmy.ml/c/lemmy_support instead.
  • Please check to see if this issue already exists.
  • It's a single bug. Do not report multiple bugs in one issue.
  • It's a frontend issue, not a backend issue; Otherwise please create an issue on the backend repo instead.

Summary

Issue #1641 introduced some unsafe content security policies. It appears unsafe-eval has been removed, but unsafe-inline still exists. (Although, unsafe-eval hasn't been specifically blocked...) As reported in issue #83, this breaks recommendations by Mozilla Observatory.

There are a ton of other bad practices that need to be fixed with the CSP. Fixing these gives us a layer of protection from future XSS attacks.

Steps to Reproduce

  1. Load web page and inspect Content-Security-Policy headers
  2. Inspect line of code that adds property
  3. Read Mozilla Observatory report

Technical Details

Any

Lemmy Instance Version

0.18.1

Lemmy Instance URL

https://observatory.mozilla.org/analyze/lemmy.world

@SineSwiper SineSwiper added the bug Something isn't working label Jul 11, 2023
@sunaurus
Copy link
Collaborator

sunaurus commented Jul 11, 2023

FYI unsafe-inline for scripts was already removed in 0.18.2.

The current rating for 0.18.2 on that observatory website is A+: https://observatory.mozilla.org/analyze/lemm.ee

Some things can still be improved, most notably unsafe-inline for style-src can be abused to deface websites:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: security bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants