Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

CSP: Defense in depth vs XSS #56

Open
DanielVF opened this issue Jan 8, 2018 · 0 comments
Open

CSP: Defense in depth vs XSS #56

DanielVF opened this issue Jan 8, 2018 · 0 comments
Assignees
Labels
devops discussion feature P4 Something to consider, a feature request that we may not pursue security

Comments

@DanielVF
Copy link
Member

DanielVF commented Jan 8, 2018

React does eliminate most XSS concerns. It does not look like the current code base is vulnerable to any know React XSS attack.

The possible future attack is if user supplied data was used in a link href. For example:

<a href={data.link_to_site}>Web/a>

In this case, the evil user could do a "javascipt:evilcode..", which would run when clicked on. I've checked the codebase, and this isn't currently a problem. However, we'd want to put something in place proactively to prevent us from doing this in the future.

The Content-Security-Policy header allows us to block inline javascript, such as inserted "javascript:" links.

We can add this line to the nginx config for demo.originprotocol.com

add_header Content-Security-Policy "default-src https:; img-src https: data:"

Alternate, you can do the metatag equivalent, and place it in the HTML header for the page.

This will

  • Block all inline javascript from being run, preventing an injection attack
  • Block any page content not loaded over HTTPS
  • Still allow our listing images to be pulled from the data urls

This is a pretty basic CSP. At some point we could explicitly whitelist the domains that we are allowed to run javascript from.

@ryana

@matthewliu matthewliu added this to Not prioritized in Origin Project Sprints via automation Apr 14, 2018
@micahalcorn micahalcorn added the P4 Something to consider, a feature request that we may not pursue label Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
devops discussion feature P4 Something to consider, a feature request that we may not pursue security
Projects
None yet
Development

No branches or pull requests

4 participants