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

feat(helmet): implement CSP policy #330

Merged
merged 2 commits into from
Jul 30, 2020
Merged

feat(helmet): implement CSP policy #330

merged 2 commits into from
Jul 30, 2020

Conversation

LoneRifle
Copy link
Contributor

Problem

Closes #291

Solution

  • Reapply feat(helmet): implement CSP policy #314
  • Loosen CSP policy to allow inline styles, data blob images
  • Trim unused embedded JavaScript in 404 page
  • Rework gtag.js and transition page to bind the click handler at
    runtime as opposed to inlining it, to comply with CSP

- Loosen CSP policy to allow inline styles, data blob images
- Trim unused embedded JavaScript in 404 page
- Rework gtag.js and transition page to bind the click handler at
  runtime as opposed to inlining it, to comply with CSP
- Limit bodyParser to JSON, since sentry is handling CSP reports
Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any way not to use unsafe-inline, even for style-src?

@LoneRifle
Copy link
Contributor Author

you can introduce a nonce, but you need to somehow modify webpack's output so that Express can dynamically inject the nonce into the bundle. For reference, @isomerpages allows unsafe-inline

@LoneRifle LoneRifle merged commit 8600950 into develop Jul 30, 2020
@LoneRifle LoneRifle deleted the feat/helmet/csp branch July 30, 2020 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement HTTP Security Headers
2 participants