Fix CSP reporting for unsafe eval in report-only.
The Content-Security-Policy-Report-Only header with script-src was not checked for "eval". This patch fixed the issue. --- This is mostly caused by the function: ~~~ void ScriptController::UpdateDocument() { window_proxy_manager_->MainWorldProxyMaybeUninitialized()->UpdateDocument(); EnableEval(); } ~~~ Line 1 makes V8 to bypass checking CSP "eval" if there are no CSP or TrustedType checks to make. So far so good! Line 2 made V8 to bypass checking CSP "eval" unconditionally. Wrong! --- The second problem was that V8 AllowCodeGenerationFromStrings was not set to false in case of 'report-only' CSP. This patch fixed this and went further. Blink now requires V8 to always call it back before any 'eval' call, no matter if there are policies or not. This is simpler. --- Bug: 980127 Change-Id: Ia5b4887cc981d85a077649df8a54cfebace245ee Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947741 Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org> Reviewed-by:Mike West <mkwst@chromium.org> Reviewed-by:
Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/master@{#721432}
Showing
Please register or sign in to comment