Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Issue 2260103003: CSP: Experimentally harden against nonce-stealing injections. (Closed)

Created:
4 years, 4 months ago by Mike West
Modified:
4 years, 3 months ago
CC:
asvitkine+watch_chromium.org, blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

CSP: Experimentally harden against nonce-stealing injections. As discussed in https://github.com/w3c/webappsec-csp/issues/98, this patch prevents execution of script via a nonce if an attribute named "<script" or "<style" is present, or if an attribute's value contains "<script" or "<style". That is, given `script-src 'nonce-abc'`, the following will execute: <script nonce=abc> // yay </script> But the following will not: <script <script nonce=abc> // yay </script> <script attribute="<script" nonce=abc> // yay </script> <script <style nonce=abc> // yay </script> <script attribute="<style" nonce=abc> // yay </script> Let's see if this is web-compatible, shall we? This patch locks the new behavior behind the experimental flag, and adds metrics that should help us understand what the real-world impact would be. BUG=639293 Committed: https://crrev.com/91dc56cc74916618193dfad3f72c448ad21089cf Cr-Commit-Position: refs/heads/master@{#415633}

Patch Set 1 #

Patch Set 2 : aaj@ #

Total comments: 1

Patch Set 3 : jww@ #

Total comments: 1

Patch Set 4 : yoav@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -6 lines) Patch
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/script-enforce-blocked.php View 1 2 2 chunks +60 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ScriptLoader.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/UseCounter.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h View 2 chunks +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp View 1 2 3 3 chunks +34 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (20 generated)
Mike West
Emily! You like CSP _and_ experiments!
4 years, 4 months ago (2016-08-19 13:38:12 UTC) #5
Mike West
+yoav, who knows things about parsing, and +jww who also loves experiments and CSP.
4 years, 4 months ago (2016-08-19 14:08:45 UTC) #9
jww
https://codereview.chromium.org/2260103003/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp File third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp (right): https://codereview.chromium.org/2260103003/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp#newcode147 third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp:147: DEFINE_STATIC_LOCAL(AtomicString, scriptString, ("<script")); What about whitespace (e.g. "< script"), ...
4 years, 4 months ago (2016-08-19 19:23:00 UTC) #13
Mike West
> https://codereview.chromium.org/2260103003/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp#newcode147 > third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp:147: DEFINE_STATIC_LOCAL(AtomicString, scriptString, ("<script")); > What about whitespace (e.g. "< script"), albeit ...
4 years, 4 months ago (2016-08-19 20:48:41 UTC) #14
jww
On 2016/08/19 20:48:41, Mike West (OOO until 29th) wrote: > > > https://codereview.chromium.org/2260103003/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp#newcode147 > > ...
4 years, 4 months ago (2016-08-19 21:01:52 UTC) #15
Mike West
On 2016/08/19 at 21:01:52, jww wrote: > > I don't think we need to check ...
4 years, 3 months ago (2016-08-31 09:16:09 UTC) #16
Mike West
Jochen, would you mind taking a look at this since jww@ is OOO?
4 years, 3 months ago (2016-08-31 09:16:38 UTC) #20
Yoav Weiss
From my perspective, LGTM % the comments that jww@ asked for https://codereview.chromium.org/2260103003/diff/40001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp File third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp (right): ...
4 years, 3 months ago (2016-08-31 10:49:59 UTC) #23
jochen (gone - plz use gerrit)
lgtm
4 years, 3 months ago (2016-08-31 11:01:39 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2260103003/60001
4 years, 3 months ago (2016-08-31 12:59:26 UTC) #29
Mike West
Thanks to you both.
4 years, 3 months ago (2016-08-31 13:01:07 UTC) #30
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 3 months ago (2016-08-31 15:08:14 UTC) #31
commit-bot: I haz the power
4 years, 3 months ago (2016-08-31 15:10:15 UTC) #33
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/91dc56cc74916618193dfad3f72c448ad21089cf
Cr-Commit-Position: refs/heads/master@{#415633}

Powered by Google App Engine
This is Rietveld 408576698