RESOLVED FIXED 201353
Resource Load Statistics: Downgrade all third-party referrer headers
https://bugs.webkit.org/show_bug.cgi?id=201353
Summary Resource Load Statistics: Downgrade all third-party referrer headers
John Wilander
Reported 2019-08-30 14:03:10 PDT
When tracking protections are enabled, we should downgrade all third-party referrers to their origins. Note that this downgrade will be specific to Cocoa so other ports will have to adopt as they see fit.
Attachments
Patch (28.18 KB, patch)
2019-08-30 15:23 PDT, John Wilander
no flags
Patch (89.57 KB, patch)
2019-09-12 17:39 PDT, John Wilander
no flags
Archive of layout-test-results from ews213 for win-future (1.97 MB, application/zip)
2019-09-12 19:07 PDT, EWS Watchlist
no flags
Patch (89.52 KB, patch)
2019-09-16 18:26 PDT, John Wilander
no flags
Archive of layout-test-results from ews214 for win-future (1.97 MB, application/zip)
2019-09-16 19:59 PDT, EWS Watchlist
no flags
Patch (89.85 KB, patch)
2019-09-17 00:06 PDT, John Wilander
no flags
Patch (90.00 KB, patch)
2019-09-17 00:35 PDT, John Wilander
no flags
Archive of layout-test-results from ews215 for win-future (13.52 MB, application/zip)
2019-09-17 02:28 PDT, EWS Watchlist
no flags
Patch (92.42 KB, patch)
2019-09-25 14:53 PDT, Kate Cheney
no flags
Archive of layout-test-results from ews214 for win-future (13.53 MB, application/zip)
2019-09-25 16:50 PDT, EWS Watchlist
no flags
Patch (93.18 KB, patch)
2019-09-25 16:52 PDT, Kate Cheney
no flags
Patch (98.40 KB, patch)
2019-09-25 19:46 PDT, Kate Cheney
no flags
Patch (99.97 KB, patch)
2019-09-26 09:21 PDT, Kate Cheney
no flags
Patch (94.36 KB, patch)
2019-09-26 17:18 PDT, Kate Cheney
no flags
Patch (94.19 KB, patch)
2019-09-26 17:38 PDT, Kate Cheney
no flags
Radar WebKit Bug Importer
Comment 1 2019-08-30 14:03:43 PDT
John Wilander
Comment 2 2019-08-30 15:23:59 PDT
Chris Dumez
Comment 3 2019-08-30 16:18:34 PDT
Comment on attachment 377755 [details] Patch Looks like this causes quite a few layout test failures, a lot of them in web-platform-tests. Aren't we concerned about compatibility here?
John Wilander
Comment 4 2019-08-30 16:19:50 PDT
I'm looking into it. I didn't think ITP was on for any of these tests. The downgrade only happens under that setting.
John Wilander
Comment 5 2019-08-30 16:22:08 PDT
Hmm. The layout tests all seem to turn ITP on. At least for Cocoa. Maybe that's desirable. How are WPT run by others? With our settings?
Chris Dumez
Comment 6 2019-08-30 16:22:56 PDT
(In reply to John Wilander from comment #5) > Hmm. The layout tests all seem to turn ITP on. At least for Cocoa. Maybe > that's desirable. How are WPT run by others? With our settings? They run the tests in Safari or STP so yes, with ITP enabled.
youenn fablet
Comment 7 2019-09-03 23:34:21 PDT
Comment on attachment 377755 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377755&action=review > Source/WebKit/ChangeLog:11 > + Cocoa so other ports will have to adopt as they see fit. It might be good to ping other port maintainers on their plan related to ITP. Ideally this code would be platform generic. Some tests are failing, ITP should probably be disabled for all WPT tests, the easiest way might be to update testharnessreport.js.
John Wilander
Comment 8 2019-09-04 05:41:36 PDT
(In reply to youenn fablet from comment #7) > Comment on attachment 377755 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=377755&action=review > > > Source/WebKit/ChangeLog:11 > > + Cocoa so other ports will have to adopt as they see fit. > > It might be good to ping other port maintainers on their plan related to ITP. > Ideally this code would be platform generic. > > Some tests are failing, ITP should probably be disabled for all WPT tests, > the easiest way might be to update testharnessreport.js. Thanks! I assume that’s upstreaming some change to testharnessreport.js? Do I first land a change locally and then do a PR somewhere?
John Wilander
Comment 9 2019-09-04 05:42:24 PDT
(In reply to John Wilander from comment #8) > (In reply to youenn fablet from comment #7) > > Comment on attachment 377755 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=377755&action=review > > > > > Source/WebKit/ChangeLog:11 > > > + Cocoa so other ports will have to adopt as they see fit. > > > > It might be good to ping other port maintainers on their plan related to ITP. > > Ideally this code would be platform generic. > > > > Some tests are failing, ITP should probably be disabled for all WPT tests, > > the easiest way might be to update testharnessreport.js. > > Thanks! > > I assume that’s upstreaming some change to testharnessreport.js? Do I first > land a change locally and then do a PR somewhere? Locally == our open source repo, not just my machine. :)
youenn fablet
Comment 10 2019-09-04 05:45:43 PDT
> > I assume that’s upstreaming some change to testharnessreport.js? Do I first > > land a change locally and then do a PR somewhere? > > Locally == our open source repo, not just my machine. :) testharnessreport.js is specific to WebKit. You just have to edit LayoutTests/resources/testharnessreport.js Tthere are already some lines dedicated to tweaking the test configuration for WPT tests only (tests served by wpt server basically).
Michael Catanzaro
Comment 11 2019-09-04 05:57:51 PDT
(In reply to youenn fablet from comment #7) > It might be good to ping other port maintainers on their plan related to ITP. > Ideally this code would be platform generic. I guess this is why I was CCed? My opinion is that GTK/WPE should prioritize implementing ITP. I know it could be ready in time for 2.28 if planned for. Limiting information available in the referrer makes a lot of sense to me, so implementing this same check in NetworkDataTaskSoup.cpp would be good. Regarding ITP and related behavior changes, I'd generally consider whatever Apple does to be the desired behavior, and any divergence from that should be treated as a port bug unless we have reason to do otherwise.
Michael Catanzaro
Comment 12 2019-09-04 06:00:39 PDT
(In reply to Michael Catanzaro from comment #11) > Limiting information > available in the referrer makes a lot of sense to me, so implementing this > same check in NetworkDataTaskSoup.cpp would be good. There's a lot of network-related code that *could* be platform-generic, but not without significant refactoring, and nobody expects John to do all that refactoring himself as he continues to tweak ITP. Adding layout tests is great because it lets port maintainers know where we need changes to match the Cocoa behavior.
John Wilander
Comment 13 2019-09-04 06:07:40 PDT
(In reply to Michael Catanzaro from comment #12) > (In reply to Michael Catanzaro from comment #11) > > Limiting information > > available in the referrer makes a lot of sense to me, so implementing this > > same check in NetworkDataTaskSoup.cpp would be good. > > There's a lot of network-related code that *could* be platform-generic, but > not without significant refactoring, and nobody expects John to do all that > refactoring himself as he continues to tweak ITP. Adding layout tests is > great because it lets port maintainers know where we need changes to match > the Cocoa behavior. Thanks for this update, Michael. That’s helpful. There are a couple of times where I’ve deliberately made an ITP change specific to Cocoa since I thought other ports wanted to decide when and if to adopt these iterative changes. I will try to reverse that thinking and share as much functionality as possible going forward.
John Wilander
Comment 14 2019-09-12 17:39:21 PDT
John Wilander
Comment 15 2019-09-12 17:39:53 PDT
Comment on attachment 378694 [details] Patch Removing the review flag for now until I see how this thing is doing on the bots.
EWS Watchlist
Comment 16 2019-09-12 19:07:54 PDT
Comment on attachment 378694 [details] Patch Attachment 378694 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/13027764 Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 17 2019-09-12 19:07:57 PDT
Created attachment 378702 [details] Archive of layout-test-results from ews213 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews213 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
John Wilander
Comment 18 2019-09-16 18:26:45 PDT
EWS Watchlist
Comment 19 2019-09-16 19:58:58 PDT
Comment on attachment 378923 [details] Patch Attachment 378923 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/13038170 Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 20 2019-09-16 19:59:00 PDT
Created attachment 378929 [details] Archive of layout-test-results from ews214 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews214 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
John Wilander
Comment 21 2019-09-17 00:06:33 PDT
John Wilander
Comment 22 2019-09-17 00:35:08 PDT
EWS Watchlist
Comment 23 2019-09-17 02:28:20 PDT
Comment on attachment 378945 [details] Patch Attachment 378945 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/13039407 New failing tests: http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html
EWS Watchlist
Comment 24 2019-09-17 02:28:23 PDT
Created attachment 378952 [details] Archive of layout-test-results from ews215 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews215 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Kate Cheney
Comment 25 2019-09-25 14:53:34 PDT
EWS Watchlist
Comment 26 2019-09-25 16:50:43 PDT
Comment on attachment 379581 [details] Patch Attachment 379581 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/13068182 New failing tests: http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html
EWS Watchlist
Comment 27 2019-09-25 16:50:47 PDT
Created attachment 379592 [details] Archive of layout-test-results from ews214 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews214 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Kate Cheney
Comment 28 2019-09-25 16:52:55 PDT
Kate Cheney
Comment 29 2019-09-25 16:53:42 PDT
trying to see if I can get this to pass mac-wk2 tests.
Kate Cheney
Comment 30 2019-09-25 19:46:39 PDT
John Wilander
Comment 31 2019-09-26 08:55:58 PDT
Comment on attachment 379616 [details] Patch Looks good to me. Thanks for bringing this one home, Kate! I'll defer the formal r+ to someone else to not review my own code. :)
Kate Cheney
Comment 32 2019-09-26 09:21:14 PDT
Kate Cheney
Comment 33 2019-09-26 09:21:49 PDT
(In reply to John Wilander from comment #31) > Comment on attachment 379616 [details] > Patch > > Looks good to me. Thanks for bringing this one home, Kate! I'll defer the > formal r+ to someone else to not review my own code. :) Sounds good :)
Brent Fulgham
Comment 34 2019-09-26 09:38:44 PDT
Comment on attachment 379646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379646&action=review Looks good. I think the tests could be a bit better with the creation of a common utility function, but that doesn't have to be done in this patch. > Tools/ChangeLog:52 > + * BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-tests accordingly. Looks like we have accidentally included extra ChangeLog stuff here. > LayoutTests/http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http-http.html:25 > + document.body.appendChild(scriptElement); It seems like this block of code could be a function provided by one of our test.js files (if there is one used by all of these tests). Otherwise we may need to update 'referrerPolicy' or 'src' in a number of places if we change our test infrastructure. Perhaps something like function referrerCompletionHandler(policy) { ... } Then this becomes: testRunner.setStatisticsShouldDowngradeReferrer(false, referrerCompletionHandler('no-referrer-when-downgrade')); > LayoutTests/http/tests/referrer-policy-script/no-referrer/cross-origin-http-http.html:24 > + }); ... and this could become: testRunner.setStatisticsShouldDowngradeReferrer(false, referrerCompletionHandler('no-referrer')); > LayoutTests/http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http-http.html:23 > + document.body.appendChild(scriptElement); ... and this could become: testRunner.setStatisticsShouldDowngradeReferrer(false, referrerCompletionHandler('origin-when-cross-origin')); > LayoutTests/http/tests/referrer-policy-script/origin/cross-origin-http.https.html:27 > + }); ... and this could become: testRunner.setStatisticsShouldDowngradeReferrer(false, referrerCompletionHandler('origin'));
Kate Cheney
Comment 35 2019-09-26 17:18:21 PDT
Kate Cheney
Comment 36 2019-09-26 17:38:47 PDT
Brent Fulgham
Comment 37 2019-09-26 21:28:55 PDT
Comment on attachment 379704 [details] Patch excellent! r=me.
WebKit Commit Bot
Comment 38 2019-09-26 22:13:17 PDT
Comment on attachment 379704 [details] Patch Clearing flags on attachment: 379704 Committed r250413: <https://trac.webkit.org/changeset/250413>
WebKit Commit Bot
Comment 39 2019-09-26 22:13:20 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.