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

Fix : allow some url to be allowed in script-src CSP #653

Merged
merged 5 commits into from
Aug 12, 2021

Conversation

asaadam
Copy link
Contributor

@asaadam asaadam commented Aug 12, 2021

Closes #651

Description

add this url, to be allowed in script-src CSP

  • *.netlify.com
  • unpkg.com
  • analytics.google.com
  • *.google-analytics.com

@netlify
Copy link

netlify bot commented Aug 12, 2021

✔️ Deploy Preview for wargabantuwarga ready!

🔨 Explore the source changes: 50a1ef1

🔍 Inspect the deploy log: https://app.netlify.com/sites/wargabantuwarga/deploys/6114f11ef14cbd00071106b1

😎 Browse the preview: https://deploy-preview-653--wargabantuwarga.netlify.app

@asaadam asaadam changed the title Fix/add more csp Fix : allow some url to be allowed in script-src CSP Aug 12, 2021
@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #653 (50a1ef1) into main (debb88a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #653   +/-   ##
=======================================
  Coverage   82.06%   82.06%           
=======================================
  Files         124      124           
  Lines        1366     1366           
  Branches      452      452           
=======================================
  Hits         1121     1121           
  Misses        237      237           
  Partials        8        8           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update debb88a...50a1ef1. Read the comment docs.

Copy link
Member

@mazipan mazipan left a comment

Choose a reason for hiding this comment

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

Looks good, let's wait to check on the Netlify Preview first ya

@asaadam
Copy link
Contributor Author

asaadam commented Aug 12, 2021

image
after see the preview
'unsafe-eval' must be allowed.

it's this okay?

@mazipan
Copy link
Member

mazipan commented Aug 12, 2021

Can we pass different config for different domain?

The error on the Homepage are Gone for now.
But for the CMS still exist.

For page under /admin/* we should allow unsafe-eval

decaporg/decap-cms#2138

@asaadam
Copy link
Contributor Author

asaadam commented Aug 12, 2021

Can we pass different config for different domain?

The error on the Homepage are Gone for now.
But for the CMS still exist.

right now I don't know how we can pass different configs for different domains.

but for now, if we want to quick fix, I will allow 'unsafe-eval'
then we will figure out later

@mazipan
Copy link
Member

mazipan commented Aug 12, 2021

How about differentiate based on path?

  for = "/admin*"
  [headers.values]
    // Set different value
  for = "/*"
  [headers.values]
    X-Frame-Options = "DENY"
    X-XSS-Protection = "1; mode=block"
    X-Content-Type-Options = "nosniff"
    Referrer-Policy = "same-origin"
    Content-Security-Policy = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' *.googletagmanager.com *.netlify.com unpkg.com analytics.google.com *.google-analytics.com; img-src 'self' blob: data: https:; frame-ancestors 'none'; "
    Permissions-Policy = "camera=(), microphone=(), geolocation=(), interest-cohort=()"

@asaadam
Copy link
Contributor Author

asaadam commented Aug 12, 2021

How about differentiate based on path?

  for = "/admin*"
  [headers.values]
    // Set different value
  for = "/*"
  [headers.values]
    X-Frame-Options = "DENY"
    X-XSS-Protection = "1; mode=block"
    X-Content-Type-Options = "nosniff"
    Referrer-Policy = "same-origin"
    Content-Security-Policy = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' *.googletagmanager.com *.netlify.com unpkg.com analytics.google.com *.google-analytics.com; img-src 'self' blob: data: https:; frame-ancestors 'none'; "
    Permissions-Policy = "camera=(), microphone=(), geolocation=(), interest-cohort=()"

ah I see, let's give it a shot

netlify.toml Outdated Show resolved Hide resolved
netlify.toml Outdated Show resolved Hide resolved
@mazipan
Copy link
Member

mazipan commented Aug 12, 2021

Still not working, so let's try to allow on all pages for now @asaadam

@asaadam
Copy link
Contributor Author

asaadam commented Aug 12, 2021

Still not working, so let's try to allow on all pages for now @asaadam

okay, working on it

@mazipan
Copy link
Member

mazipan commented Aug 12, 2021

Works in my end.
let's discuss later with @resir014 ya to tackle this issue properly.

@mazipan mazipan added the automerge To be merged automatically once all the requirements are fulfilled label Aug 12, 2021
@kodiakhq kodiakhq bot merged commit 1ab522e into kawalcovid19:main Aug 12, 2021
@mazipan
Copy link
Member

mazipan commented Aug 12, 2021

@all-contributors please add @asaadam for code

@allcontributors
Copy link
Contributor

@mazipan

I've put up a pull request to add @asaadam! 🎉

phdd added a commit to phdd/coachbar-dresden.de that referenced this pull request Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge To be merged automatically once all the requirements are fulfilled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSP cause Netlify CMS failed to open
2 participants