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

Update react-error-overlay CSP hash #1792

Merged
merged 2 commits into from
Dec 7, 2023
Merged

Update react-error-overlay CSP hash #1792

merged 2 commits into from
Dec 7, 2023

Conversation

lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Dec 6, 2023

Broken since 9c7da1a

Note: react-error-overlay only appears during development, and csp-react-error-overlay.spec.ts doesn't test it on CI. Running it locally detects it as broken tho.

@lukaw3d lukaw3d requested a review from buberdds December 6, 2023 01:38
Copy link

github-actions bot commented Dec 6, 2023

Deployed to Cloudflare Pages

Latest commit: e695fea9eb36e9d1eb36bb0bf81c7b42b7840d6b
Status:✅ Deploy successful!
Preview URL: https://7c08acdd.oasis-wallet.pages.dev

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Merging #1792 (7547175) into master (f11500c) will decrease coverage by 0.08%.
The diff coverage is n/a.

❗ Current head 7547175 differs from pull request most recent head e695fea. Consider uploading reports for the commit e695fea to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1792      +/-   ##
==========================================
- Coverage   81.44%   81.36%   -0.08%     
==========================================
  Files         191      191              
  Lines        5067     5067              
  Branches      930      930              
==========================================
- Hits         4127     4123       -4     
- Misses        940      944       +4     
Flag Coverage Δ
cypress 45.89% <ø> (ø)
jest 77.23% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 2 files with indirect coverage changes

@@ -17,7 +17,7 @@ const localnet = `
const hmrWebsocket = `
ws://localhost:2222
`
const reactErrorOverlay = `'sha256-RV6I4HWPb71LvA27WVD3cEz8GsJrHlfcM/2X2Q5gV00='`
const reactErrorOverlay = `'sha256-yt+SNVxRkIi6H6yb7ndFuZM1esMX9esg3UpRHaTsyVk='`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment where we can find this ID so everyone is aware of it and also when it changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Related: #1609 (comment)

I copy it from chrome console, it's printed on any hot-module-reload when it's broken.

Modified the test so it would now print:

  1) [chromium]  csp-react-error-overlay.spec.ts:5:5  Dev Content-Security-Policy should allow react-error-overlay 

    Error: expect(received).not.toMatchObject(expected)

    Expected: not {"type": "error"}
    Received:     {"args": [], "location": {"columnNumber": 0, "lineNumber": 2769, "url": "http://localhost:3000/index.2b04b272.js"}, "text": "Refused to execute inline script because it violates the following Content Security Policy directive: \"script-src 'self' 'sha256-RV6I4HWPb71LvA27WVD3cEz8GsJrHlfcM/2X2Q5gV00=' 'unsafe-eval' 'report-sample'\". Either the 'unsafe-inline' keyword, a hash ('sha256-yt+SNVxRkIi6H6yb7ndFuZM1esMX9esg3UpRHaTsyVk='), or a nonce ('nonce-...') is required to enable inline execution.
    ", "type": "error"}

       at ../utils/expectNoErrorsInConsole.ts:37

      35 |         text: message.text(),
      36 |         type: message.type(),
    > 37 |       }).not.toMatchObject({
         |              ^
      38 |         type: 'error',
      39 |       })
      40 |     }

it's hard to make a prettier output

@lukaw3d lukaw3d merged commit cbd5468 into master Dec 7, 2023
10 checks passed
@lukaw3d lukaw3d deleted the lw/react-err-csp branch December 7, 2023 05:05
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.

None yet

2 participants