keybase / keybase/client

[Website] Enable Content Security Policy

Open
#12,719 1 comment 1 reaction 0 assignees View on GitHub

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:

  1. 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.
  2. 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:

  1. Make an educated guess at a policy, and implement as report-only via Content-Security-Policy-Report-Only header.
  2. Set the report-uri directive to point to an endpoint you control. (I recommend https://report-uri.com/ free account should be fine.)
  3. Monitor for a few days or weeks or whatever.
  4. 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.
  5. Fix the policy.
  6. Switch to Content-Security-Policy and actually enforce.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.