Intent to Implement and Ship: Limit `Referer` header's length to 4k.

301 views
Skip to first unread message

Mike West

unread,
Jun 6, 2019, 8:07:00 AM6/6/19
to blink-dev
mk...@chromium.org https://github.com/whatwg/fetch/issues/903 Specification: https://github.com/w3c/webappsec-referrer-policy/pull/122 https://github.com/whatwg/fetch/issues/903 This is a very minor change, with two other vendors signing off. If the `Referer` header's value would exceed 4k, it will be stripped down to an origin. As noted in https://github.com/xsleaks/xsleaks/wiki/Browser-Side-Channels#cache-and-error-events, servers will often behave in unexpected ways when presented with an overly-long `Referer` header. This is unfortunate, as `Referer` is one header whose length attackers generally retain control over when generating `no-cors` requests. Perhaps we can cap it to something reasonable?
There's some risk to altering the `referer` header, as sites do use it in various ways. This risk seems manageable. Based on Chrome's telemetry from Canary/Dev, the header is rarely long enough to be affected: capping the length at 4k would affect 1 in 10,000 requests. The percentiles look like: * 25.00% 27.53 * 50.00% 44.76 * 75.00% 79.71 * 95.00% 263.3 * 99.00% 986.5 * 99.50% 1232 * 99.90% 1956 * 99.99% 4162 Still, there's some risk that dropping path information could have an adverse affect on some site, somewhere. We ran an experiment in Canary/Dev that stripped headers down to an origin at 4k and 2k, but didn't find any statistically relevant difference in error rates for either top-level navigations or subresource requests. Mozilla and Edge folks both are willing follow us to 4k if we land it successfully (in fact, both suggested lower limits). Firefox: Public support (https://github.com/whatwg/fetch/issues/903) Edge: No public signals (https://github.com/whatwg/fetch/issues/903) Safari: No public signals Web developers: No signals None. None. We considered simply cutting the `Referer` header's value at the limit, rather than stripping it down to an origin. This would potentially leave the URL in a strange state by breaking %-encoding, or removing security-critical GET parameters. An origin is significantly more likely to be safe.
The header will be represented correctly in devtools, just as it is today. Yes It will be. The existing `referrer-policy` tests are extended in https://chromium-review.googlesource.com/c/chromium/src/+/1646784 (https://github.com/web-platform-tests/wpt/pull/17204) to cover the length limitation. https://bugs.chromium.org/p/chromium/issues/detail?id=959757 https://www.chromestatus.com/features/5648956820291584

-mike

Yoav Weiss

unread,
Jun 6, 2019, 8:30:15 AM6/6/19
to Mike West, blink-dev
4K Referer headers ought to be enough for anybody :D

LGTM1

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKXHy%3DcA7Xn%3DMYi_g-Q%3D2_LpFkL3erPEwQAnauRWuKfU7dcwMw%40mail.gmail.com.

Jochen Eisinger

unread,
Jun 6, 2019, 10:11:00 AM6/6/19
to Yoav Weiss, Mike West, blink-dev

Chris Harrelson

unread,
Jun 6, 2019, 10:12:51 AM6/6/19
to Jochen Eisinger, Yoav Weiss, Mike West, blink-dev

Eric Lawrence

unread,
Jun 6, 2019, 1:28:15 PM6/6/19
to blink-dev
lgtm: I think Edge is meant to say Public support. ;-) 

ati...@outlook.com

unread,
Oct 4, 2019, 12:03:38 PM10/4/19
to blink-dev
Thank you for this security feature update. However, this is breaking some features for our long URLs. How can I disable this feature temporarily from command line so it does not limit?

Mike West

unread,
Oct 4, 2019, 12:12:25 PM10/4/19
to ati...@outlook.com, blink-dev
For the moment, you can append `--disable-features=CapRefererHeaderLength` to your command line. Note, though, that I intend to remove this in Chrome ~80, which will hit stable early next year. I hope you can find a workaround in the next few months! :)

-mike


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Reply all
Reply to author
Forward
0 new messages