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 script-src and worker-src directives #4838

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Conversation

groovecoder
Copy link
Member

@groovecoder groovecoder commented Jul 1, 2024

Google Tag Manager needs script-src: unsafe-inline and worker-src: blob:. I created this branch to test these updates on the dev server.

This fix already works on dev, because API_DOCS_ENABLED is set to True.

For stage & prod, we will need to set two new env vars:

  • CSP_SCRIPT_UNSAFE_INLINE=True
  • CSP_WORKER_BLOB=True

How to test on dev:

  1. Open a tab to https://analytics.google.com/analytics/web/#/p314403930/realtime/overview
  2. Go to https://dev.fxprivaterelay.nonprod.cloudops.mozgcp.net/
  3. Perform some actions on the page
    • No activity shows up in GA4
  4. Push this branch to the dev server
  5. Go to https://dev.fxprivaterelay.nonprod.cloudops.mozgcp.net/
  6. Perform some actions on the page
    • Activity shows up in GA4

How to test on stage:

  1. Open a tab to https://analytics.google.com/analytics/web/#/p314403930/realtime/overview
  2. Go to https://stage.fxprivaterelay.nonprod.cloudops.mozgcp.net/
  3. Perform some actions on the page
    • No activity shows up in GA4
  4. Push this release to the stage server
    • Set CSP_SCRIPT_UNSAFE_INLINE=True
    • Set CSP_WORKER_BLOB=True
  5. Go to https://stage.fxprivaterelay.nonprod.cloudops.mozgcp.net/
  6. Perform some actions on the page
    • Activity shows up in GA4
  • l10n changes have been submitted to the l10n repository, if any.
  • I've added a unit test to test for potential regressions of this bug.
  • I've added or updated relevant docs in the docs/ directory.
  • All UI revisions follow the coding standards, and use Protocol tokens where applicable (see /frontend/src/styles/tokens.scss).
  • Commits in this PR are minimal and have descriptive commit messages.

@groovecoder groovecoder requested a review from jwhitlock July 1, 2024 19:10
@groovecoder groovecoder marked this pull request as ready for review July 1, 2024 19:45
Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks @groovecoder!

@groovecoder groovecoder added this pull request to the merge queue Jul 2, 2024
Merged via the queue into main with commit 983e5b1 Jul 2, 2024
29 checks passed
@groovecoder groovecoder deleted the fix-csp-for-ga4 branch July 2, 2024 16:15
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.

2 participants