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

Issue 2970913002: Implement CORS preflights for Expect-CT reports (Closed)

Created:
3 years, 5 months ago by estark
Modified:
3 years, 5 months ago
Reviewers:
meacer
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement CORS preflights for Expect-CT reports Expect-CT reports are sent with a Content-Type header of application/expect-ct-report+json. This Content-Type (nor "application/json") is not CORS safelisted, meaning that Chrome arguably ought to send CORS preflights to make sure the designated report collection server has opted in to receive Expect-CT reports. Otherwise, web content would be able to trigger reports to arbitrary endpoints with a non-safelisted Content-Type header. Therefore, this CL implements CORS preflight requests before sending reports. The wrinkle is that Expect-CT is checked at connection setup time, before being associated with a particular URLRequest, much less an initiating origin, so we cannot construct a proper Origin header to include in the preflight request. Instead, we set the Origin header to "null", and expect `Access-Control-Allow-Origin: *` or `Access-Control-Allow-Origin: null` in response. While this is a bit weird, it is safe because reports are sent without credentials and it requires the server to opt in to receiving reports. See https://lists.w3.org/Archives/Public/ietf-http-wg/2017AprJun/0168.html for more discussion on the CORS issues and background on why we have settled on sending `Origin: null` preflights. https://fetch.spec.whatwg.org/#cors-preflight-fetch describes the preflights implemented in this CL. BUG=679012 Review-Url: https://codereview.chromium.org/2970913002 Cr-Commit-Position: refs/heads/master@{#484849} Committed: https://chromium.googlesource.com/chromium/src/+/70adceb53e4a7c7d1cbfa080ab6fd4d6ae2878c6

Patch Set 1 #

Total comments: 23

Patch Set 2 : meacer comments #

Total comments: 4

Patch Set 3 : meacer nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+383 lines, -30 lines) Patch
M chrome/browser/ssl/chrome_expect_ct_reporter.h View 1 3 chunks +50 lines, -1 line 0 comments Download
M chrome/browser/ssl/chrome_expect_ct_reporter.cc View 1 2 4 chunks +107 lines, -3 lines 0 comments Download
M chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc View 1 8 chunks +226 lines, -26 lines 0 comments Download

Messages

Total messages: 26 (13 generated)
estark
meacer, can you please review? This is the last major bit of implementation work for ...
3 years, 5 months ago (2017-07-05 05:47:33 UTC) #2
meacer
On 2017/07/05 05:47:33, estark (OOO until Jul 10) wrote: > meacer, can you please review? ...
3 years, 5 months ago (2017-07-05 20:50:11 UTC) #7
meacer
And the CL review https://codereview.chromium.org/2970913002/diff/1/chrome/browser/ssl/chrome_expect_ct_reporter.cc File chrome/browser/ssl/chrome_expect_ct_reporter.cc (right): https://codereview.chromium.org/2970913002/diff/1/chrome/browser/ssl/chrome_expect_ct_reporter.cc#newcode34 chrome/browser/ssl/chrome_expect_ct_reporter.cc:34: bool FindHeaderValues(net::URLRequest* request, nit: Rename ...
3 years, 5 months ago (2017-07-05 23:48:59 UTC) #8
estark
On 2017/07/05 20:50:11, meacer wrote: > On 2017/07/05 05:47:33, estark (OOO until Jul 10) wrote: ...
3 years, 5 months ago (2017-07-06 06:05:44 UTC) #9
estark
https://codereview.chromium.org/2970913002/diff/1/chrome/browser/ssl/chrome_expect_ct_reporter.cc File chrome/browser/ssl/chrome_expect_ct_reporter.cc (right): https://codereview.chromium.org/2970913002/diff/1/chrome/browser/ssl/chrome_expect_ct_reporter.cc#newcode34 chrome/browser/ssl/chrome_expect_ct_reporter.cc:34: bool FindHeaderValues(net::URLRequest* request, On 2017/07/05 23:48:59, meacer wrote: > ...
3 years, 5 months ago (2017-07-06 06:39:43 UTC) #12
meacer
On 2017/07/06 06:05:44, estark (OOO until Jul 10) wrote: > On 2017/07/05 20:50:11, meacer wrote: ...
3 years, 5 months ago (2017-07-06 20:04:51 UTC) #15
meacer
Lgtm https://codereview.chromium.org/2970913002/diff/1/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc File chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc (right): https://codereview.chromium.org/2970913002/diff/1/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc#newcode74 chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc:74: void WaitForReport(const GURL& report_uri, const base::Closure& callback) { ...
3 years, 5 months ago (2017-07-06 22:03:45 UTC) #16
estark
On 2017/07/06 20:04:51, meacer wrote: > On 2017/07/06 06:05:44, estark (OOO until Jul 10) wrote: ...
3 years, 5 months ago (2017-07-07 06:07:08 UTC) #17
estark
https://codereview.chromium.org/2970913002/diff/20001/chrome/browser/ssl/chrome_expect_ct_reporter.cc File chrome/browser/ssl/chrome_expect_ct_reporter.cc (right): https://codereview.chromium.org/2970913002/diff/20001/chrome/browser/ssl/chrome_expect_ct_reporter.cc#newcode220 chrome/browser/ssl/chrome_expect_ct_reporter.cc:220: (response_code < 200 || response_code > 299)) { On ...
3 years, 5 months ago (2017-07-07 06:07:21 UTC) #18
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/2970913002/40001
3 years, 5 months ago (2017-07-07 06:07:33 UTC) #21
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/70adceb53e4a7c7d1cbfa080ab6fd4d6ae2878c6
3 years, 5 months ago (2017-07-07 07:09:35 UTC) #24
lijeffrey
On 2017/07/07 07:09:35, commit-bot: I haz the power wrote: > Committed patchset #3 (id:40001) as ...
3 years, 5 months ago (2017-07-14 18:53:37 UTC) #25
estark
3 years, 5 months ago (2017-07-14 22:16:20 UTC) #26
Message was sent while issue was closed.
On 2017/07/14 18:53:37, lijeffrey wrote:
> On 2017/07/07 07:09:35, commit-bot: I haz the power wrote:
> > Committed patchset #3 (id:40001) as
> >
>
https://chromium.googlesource.com/chromium/src/+/70adceb53e4a7c7d1cbfa080ab6f...
> 
> Findit suggests this CL introduced a flaky test
> "ChromeExpectCTReporterTest.BadCORSPreflightResponseOrigin" according to
> analysis
>
https://findit-for-me.appspot.com/waterfall/flake?key=ag9zfmZpbmRpdC1mb3ItbWV...
> 
> Can someone please help verify?
> 
> Thanks,
> Jeff on behalf of Findit team

^ I'm looking into it

Powered by Google App Engine
This is Rietveld 408576698