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

Add constent security policy headers to free.law #36

Open
mlissner opened this issue Feb 25, 2020 · 3 comments · Fixed by #48
Open

Add constent security policy headers to free.law #36

mlissner opened this issue Feb 25, 2020 · 3 comments · Fixed by #48
Labels

Comments

@mlissner
Copy link
Member

mlissner commented Feb 25, 2020

This isn't terribly hard, except that it means revisiting all our pages to make sure we don't use any <script> tags or inline JavaScript.

See more details here: https://infosec.mozilla.org/guidelines/web_security#content-security-policy

When the time comes to add them, we just need to tweak our existing Lambda@Edge distribution (in N.Virginia, which already adds a few other security headers for us).

@mlissner
Copy link
Member Author

mlissner commented Dec 8, 2020

A researcher recently suggested that we add X-XSS-Protection headers, but MDN says we should add CSP headers instead and that X-XSS-Protection is outdated.

@mlissner
Copy link
Member Author

mlissner commented Dec 9, 2020

I went ahead an added the X-XSS-Protection header. It's no harm, and it can only help. But I don't think it really matters, since we don't usually embed user-generated content on the site. The process to do it was to update the lambda function and to then deploy it to lambda@edge. Note that that is different than just deploying it.

@mlissner
Copy link
Member Author

mlissner commented Aug 3, 2021

I took another brief pass at this today and came up with:

        Content-Security-Policy = "default-src 'self'; connect-src 'self' https://matomo.courtlistener.com; script-src 'self' https://matomo.courtlistener.com; img-src 'self' https://matomo.courtlistener.com; style-src 'self' https://matomo.courtlistener.com; frame-src: 'self', *.youtube.com, *.courtlistener.com, *.legaltalknetwork.com; object-src 'none'"

But it didn't work. In Firefox, I got messages like:

The page’s settings blocked the loading of a resource at inline xyz

Which means nextjs uses inline stuff. There are guides about this, but I think they're going to amount to allowing inline JS. Since we're SSG anyway, I'm not sure much of this much matters, but if somebody wants to take another stab at this, netlify's deploy mode works nicely.

@mlissner mlissner reopened this Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant