[Website] Enable Content Security Policy
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 9.2k
- Forks
- 1.3k
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 56
Description
Major reasons to implement:
- It heavily locks down ways for any script to contact the outside world from the context of the page, making it extremely difficult for people to exfiltrate data.
- The only downsides are when you have analytics scripts and tag managers running, as CSP shuts them down easily... but keybase doesn't have any analytics on it from what I can tell.
Some info I gathered:
default-src 'self' https://keybase.io https://s3.amazonaws.com; object-src 'none'; report-uri https://somereporturi/some/path should be sufficient tbh and would be a good jumping off point.
The only problems I can see is sometimes inline JS is injected... like the window.csrf_token = "xxx" script tag... this could be taken care of with a nonce directive... or you could tweak your site to not need inline JS.
Most CSP policies are rolled out as follows:
- Make an educated guess at a policy, and implement as report-only via
Content-Security-Policy-Report-Onlyheader. - Set the report-uri directive to point to an endpoint you control. (I recommend https://report-uri.com/ free account should be fine.)
- Monitor for a few days or weeks or whatever.
- If you notice a large number of users hitting the same violation over and over, consider either adding a directive to open a hole for it, or fix the site to remove the access.
- Fix the policy.
- Switch to
Content-Security-Policyand actually enforce.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the website response-header configuration and reviewing the proposed Content-Security-Policy-Report-Only policy, including the inline CSRF script and report endpoint. Done means monitoring violations, resolving required exceptions, and switching to an enforced Content-Security-Policy header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- security, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100