Skip to content

Commit

Permalink
bug #36315 [WebProfilerBundle] Support for Content Security Policy st…
Browse files Browse the repository at this point in the history
…yle-src-elem and script-src-elem in WebProfiler (ampaze)

This PR was merged into the 3.4 branch.

Discussion
----------

[WebProfilerBundle] Support for Content Security Policy style-src-elem and script-src-elem in WebProfiler

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| License       | MIT

If a `style-src-elem` or `script-src-elem` Content Security Policy exist, the WebProfiler Styles or Scripts will be rejected as the nonce is missing.

Commits
-------

7f33f1f Support for Content Security Policy style-src-elem and script-src-elem in WebProfiler
  • Loading branch information
fabpot committed Apr 4, 2020
2 parents 21a6ab0 + 7f33f1f commit 004f1f3
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -128,7 +128,7 @@ private function updateCspHeaders(Response $response, array $nonces = [])
$headers = $this->getCspHeaders($response);

foreach ($headers as $header => $directives) {
foreach (['script-src' => 'csp_script_nonce', 'style-src' => 'csp_style_nonce'] as $type => $tokenName) {
foreach (['script-src' => 'csp_script_nonce', 'script-src-elem' => 'csp_script_nonce', 'style-src' => 'csp_style_nonce', 'style-src-elem' => 'csp_style_nonce'] as $type => $tokenName) {
if ($this->authorizesInline($directives, $type)) {
continue;
}
Expand Down

0 comments on commit 004f1f3

Please sign in to comment.