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

Issue 2708873002: Stop CSP from matching independent scheme/port upgrades (Closed)

Created:
3 years, 10 months ago by andypaicu
Modified:
3 years, 9 months ago
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Stop CSP from matching independent scheme/port upgrades Content-Security-Policy allows an url to match a source-expression even if the scheme or the port doesn't matches, but in this case it must be an upgrade to a more secure scheme(http->https) and more secure port(80->443). The problem is that it happens independently, so it is allowed to have an upgrade of the port without the scheme (http over 443) or an upgrade of the scheme without the port (https over 80). This is a change to force the upgrade to be both over port and scheme. BUG=692499, 692442 Review-Url: https://codereview.chromium.org/2708873002 Cr-Commit-Position: refs/heads/master@{#456376} Committed: https://chromium.googlesource.com/chromium/src/+/d25a9b7ba1e9858fe4d444267524f8ebe8ad8594

Patch Set 1 #

Total comments: 8

Patch Set 2 : Refactoring port/scheme matching logic to have an easier time with auto-upgrading #

Total comments: 8

Patch Set 3 : CR suggestions #

Patch Set 4 : rebase-update #

Unified diffs Side-by-side diffs Delta from patch set Stats (+136 lines, -51 lines) Patch
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10.html View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPSource.h View 1 2 2 chunks +33 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPSource.cpp View 1 2 4 chunks +69 lines, -28 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp View 1 2 4 chunks +24 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp View 1 2 3 1 chunk +6 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/SourceListDirective.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 37 (25 generated)
andypaicu
3 years, 10 months ago (2017-02-21 13:31:39 UTC) #4
Mike West
A few comments inline... https://codereview.chromium.org/2708873002/diff/1/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp File third_party/WebKit/Source/core/frame/csp/CSPSource.cpp (right): https://codereview.chromium.org/2708873002/diff/1/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp#newcode122 third_party/WebKit/Source/core/frame/csp/CSPSource.cpp:122: isSchemeHttp = m_policy->protocolIsEqual("http"); This will ...
3 years, 10 months ago (2017-02-21 14:24:04 UTC) #5
andypaicu
Honestly the more I look at it the more I fell like the auto upgrade ...
3 years, 10 months ago (2017-02-21 15:51:44 UTC) #8
Mike West
On 2017/02/21 at 15:51:44, andypaicu wrote: > Honestly the more I look at it the ...
3 years, 10 months ago (2017-02-22 12:03:40 UTC) #9
andypaicu
https://codereview.chromium.org/2708873002/diff/20001/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp File third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp (right): https://codereview.chromium.org/2708873002/diff/20001/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp#newcode167 third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp:167: EXPECT_TRUE(source.matches(KURL(base, "https-so://a.com"))); Added 692442 since this will also fix ...
3 years, 10 months ago (2017-02-24 08:41:00 UTC) #13
Mike West
LGTM. https://codereview.chromium.org/2708873002/diff/20001/third_party/WebKit/Source/core/frame/csp/CSPSource.h File third_party/WebKit/Source/core/frame/csp/CSPSource.h (right): https://codereview.chromium.org/2708873002/diff/20001/third_party/WebKit/Source/core/frame/csp/CSPSource.h#newcode26 third_party/WebKit/Source/core/frame/csp/CSPSource.h:26: // matches. NotMatching should always be 0 to ...
3 years, 10 months ago (2017-02-24 10:56:28 UTC) #16
andypaicu
@jochen could you have a quick look at the suborigin test and confirm if it ...
3 years, 9 months ago (2017-03-13 10:07:20 UTC) #20
Mike West
Still LGTM.
3 years, 9 months ago (2017-03-13 10:17:06 UTC) #21
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/2708873002/40001
3 years, 9 months ago (2017-03-13 11:27:51 UTC) #25
commit-bot: I haz the power
Failed to apply patch for third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp: While running git apply --index -p1; error: patch failed: ...
3 years, 9 months ago (2017-03-13 11:33:44 UTC) #27
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/2708873002/60001
3 years, 9 months ago (2017-03-13 14:32:58 UTC) #34
commit-bot: I haz the power
3 years, 9 months ago (2017-03-13 14:37:59 UTC) #37
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/d25a9b7ba1e9858fe4d444267524...

Powered by Google App Engine
This is Rietveld 408576698