Skip to content

Fix CSP directive in production#3176

Merged
gbrodman merged 1 commit into
google:masterfrom
gbrodman:fixCsp
Jul 23, 2026
Merged

Fix CSP directive in production#3176
gbrodman merged 1 commit into
google:masterfrom
gbrodman:fixCsp

Conversation

@gbrodman

@gbrodman gbrodman commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

In prod, when loading the console, we were failing to get some
scripts/styles with the error "Executing
inline event handler violates the following Content Security Policy directive 'script-src
'self''. Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-
...') is required to enable inline execution. Note that hashes do not apply to event
handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword
is present. The action has been blocked."

We fix this by disabling inline-critical optimization for prod in the
angular file.

In addition, the web.xml header values are comma-separated -- we forgot
one comma before.


This change is Reviewable

@gbrodman
gbrodman requested a review from ptkach July 23, 2026 18:10
@gbrodman

Copy link
Copy Markdown
Collaborator Author

note: tested, on Pavlo's suggestion, by

  1. on master, modifying the angular config to make alpha the same as prod
  2. deployed to alpha, saw the same errors that prod is currently seeing
  3. went to this branch, made the same modifications as step 1
  4. deployed to alpha, the errors are gone

@ptkach ptkach left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@ptkach reviewed 3 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on gbrodman).

In prod, when loading the console, we were failing to get some
scripts/styles with the error "Executing
  inline event handler violates the following Content Security Policy directive 'script-src
  'self''. Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-
  ...') is required to enable inline execution. Note that hashes do not apply to event
  handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword
  is present. The action has been blocked."

We fix this by disabling inline-critical optimization for prod in the
angular file.

In addition, the web.xml header values are comma-separated -- we forgot
one comma before.
@gbrodman
gbrodman enabled auto-merge July 23, 2026 20:52
@gbrodman
gbrodman added this pull request to the merge queue Jul 23, 2026
Merged via the queue into google:master with commit 53b6044 Jul 23, 2026
15 of 16 checks passed
@gbrodman
gbrodman deleted the fixCsp branch July 23, 2026 21:51
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