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

Issue 481643002: Disallow non-subdomain wildcards in the extension's CSP (Closed)

Created:
6 years, 4 months ago by robwu
Modified:
6 years, 4 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Disallow non-subdomain wildcards such as https:// and https://*.com wildcard patterns in the extension's Content Security policy and update the documentation to clarify the constraints of the CSP. BUG=404295 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=290699

Patch Set 1 #

Total comments: 4

Patch Set 2 : .length() > 8 replaced with != "https://" and add comment #

Patch Set 3 : Disallow RCD and non-subdomain wildcards #

Total comments: 13

Patch Set 4 : check for chrome:// and chrome-extension:// wildcards, update documentation #

Total comments: 2

Patch Set 5 : www.w3.org/TR/CSP11 -> www.w3.org/TR/CSP2 #

Total comments: 3

Patch Set 6 : combine url parsing logic #

Total comments: 3

Patch Set 7 : add code comments #

Patch Set 8 : . -> , #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -29 lines) Patch
M chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html View 1 2 3 1 chunk +12 lines, -3 lines 0 comments Download
M extensions/common/csp_validator.cc View 1 2 3 4 5 6 7 3 chunks +65 lines, -26 lines 0 comments Download
M extensions/common/csp_validator_unittest.cc View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 32 (0 generated)
robwu
Based on the existing unit tests, it seems that wildcards CSP directives are undesired, so ...
6 years, 4 months ago (2014-08-16 10:34:15 UTC) #1
not at google - send to devlin
I'd be more comfortable if mkwst and jww had a look at this. My CSP ...
6 years, 4 months ago (2014-08-18 17:17:18 UTC) #2
robwu
https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc#newcode74 extensions/common/csp_validator.cc:74: (StartsWithASCII(source, "https://", true) && source.length() > 8) || On ...
6 years, 4 months ago (2014-08-18 19:50:05 UTC) #3
not at google - send to devlin
https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc#newcode74 extensions/common/csp_validator.cc:74: (StartsWithASCII(source, "https://", true) && source.length() > 8) || On ...
6 years, 4 months ago (2014-08-18 19:53:40 UTC) #4
robwu
https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc#newcode74 extensions/common/csp_validator.cc:74: (StartsWithASCII(source, "https://", true) && source.length() > 8) || On ...
6 years, 4 months ago (2014-08-18 21:08:18 UTC) #5
jww
On 2014/08/18 21:08:18, robwu wrote: > https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc > File extensions/common/csp_validator.cc (right): > > https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc#newcode74 > ...
6 years, 4 months ago (2014-08-18 21:54:35 UTC) #6
not at google - send to devlin
On 2014/08/18 21:54:35, jww wrote: > On 2014/08/18 21:08:18, robwu wrote: > > > https://codereview.chromium.org/481643002/diff/1/extensions/common/csp_validator.cc ...
6 years, 4 months ago (2014-08-18 21:56:17 UTC) #7
robwu
I've updated the CL to disallow RCD wildcards.
6 years, 4 months ago (2014-08-19 11:39:34 UTC) #8
not at google - send to devlin
Comments aside I'm stalling a little until mkwst can have a look, I'm not comfortable ...
6 years, 4 months ago (2014-08-19 15:05:58 UTC) #9
not at google - send to devlin
https://codereview.chromium.org/481643002/diff/40001/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/40001/extensions/common/csp_validator.cc#newcode56 extensions/common/csp_validator.cc:56: start_of_host += 2; (We do have URLPattern but I'm ...
6 years, 4 months ago (2014-08-19 15:07:22 UTC) #10
robwu
https://codereview.chromium.org/481643002/diff/40001/chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html File chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html (right): https://codereview.chromium.org/481643002/diff/40001/chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html#newcode276 chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html:276: not be accepted. Currently, we allow whitelisting origins with ...
6 years, 4 months ago (2014-08-19 16:31:39 UTC) #11
Mike West
Code change LGTM. I'm not personally sure that there's a ton of value in locking ...
6 years, 4 months ago (2014-08-19 16:53:07 UTC) #12
not at google - send to devlin
> I'm not personally sure that there's a ton of value in locking developers out ...
6 years, 4 months ago (2014-08-19 16:59:47 UTC) #13
robwu
On 2014/08/19 16:59:47, kalman wrote: > > I'm not personally sure that there's a ton ...
6 years, 4 months ago (2014-08-19 17:18:31 UTC) #14
not at google - send to devlin
https://codereview.chromium.org/481643002/diff/80001/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/80001/extensions/common/csp_validator.cc#newcode30 extensions/common/csp_validator.cc:30: const char kHttpSchemeAndSeparator[] = "https://"; Https https://codereview.chromium.org/481643002/diff/80001/extensions/common/csp_validator.cc#newcode69 extensions/common/csp_validator.cc:69: It's ...
6 years, 4 months ago (2014-08-19 17:39:23 UTC) #15
abarth-chromium
On 2014/08/19 at 17:18:31, rob wrote: > Looks like Adam's: https://codereview.chromium.org/8773028 > @abarth Why are ...
6 years, 4 months ago (2014-08-19 18:21:57 UTC) #16
abarth-chromium
https://www.*.example.com ^^^ CSP doesn't support this sort of wildcarding. The * has to be leftmost ...
6 years, 4 months ago (2014-08-19 18:22:44 UTC) #17
robwu
On 2014/08/19 18:22:44, abarth wrote: > https://www.*.example.com > > ^^^ CSP doesn't support this sort ...
6 years, 4 months ago (2014-08-19 18:35:56 UTC) #18
abarth-chromium
On 2014/08/19 at 18:35:56, rob wrote: > Does this make sense? Should I amend the ...
6 years, 4 months ago (2014-08-19 19:00:23 UTC) #19
not at google - send to devlin
IMO what you have is fine.
6 years, 4 months ago (2014-08-19 19:20:08 UTC) #20
robwu
https://codereview.chromium.org/481643002/diff/80001/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/80001/extensions/common/csp_validator.cc#newcode69 extensions/common/csp_validator.cc:69: On 2014/08/19 17:39:22, kalman wrote: > It's a shame ...
6 years, 4 months ago (2014-08-19 20:04:16 UTC) #21
not at google - send to devlin
lgtm https://codereview.chromium.org/481643002/diff/100001/extensions/common/csp_validator.cc File extensions/common/csp_validator.cc (right): https://codereview.chromium.org/481643002/diff/100001/extensions/common/csp_validator.cc#newcode41 extensions/common/csp_validator.cc:41: Comment for this method. https://codereview.chromium.org/481643002/diff/100001/extensions/common/csp_validator.cc#newcode63 extensions/common/csp_validator.cc:63: if (start_of_port ...
6 years, 4 months ago (2014-08-19 20:14:28 UTC) #22
robwu
Added comments. Thanks for the review.
6 years, 4 months ago (2014-08-19 21:01:33 UTC) #23
not at google - send to devlin
No problem, thanks for the contribution!
6 years, 4 months ago (2014-08-19 21:02:40 UTC) #24
robwu
The CQ bit was checked by rob@robwu.nl
6 years, 4 months ago (2014-08-19 21:03:11 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rob@robwu.nl/481643002/120001
6 years, 4 months ago (2014-08-19 21:04:28 UTC) #26
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_gpu on tryserver.chromium.gpu ...
6 years, 4 months ago (2014-08-19 22:22:02 UTC) #27
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-08-19 22:28:08 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/461) mac_chromium_rel_swarming on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_swarming/builds/4880)
6 years, 4 months ago (2014-08-19 22:28:09 UTC) #29
robwu
The CQ bit was checked by rob@robwu.nl
6 years, 4 months ago (2014-08-19 22:35:10 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rob@robwu.nl/481643002/140001
6 years, 4 months ago (2014-08-19 22:36:34 UTC) #31
commit-bot: I haz the power
6 years, 4 months ago (2014-08-19 23:48:31 UTC) #32
Message was sent while issue was closed.
Committed patchset #8 (140001) as 290699

Powered by Google App Engine
This is Rietveld 408576698