w3c / webappsec-referrer-policy

WebAppSec Referrer Policy
https://w3c.github.io/webappsec-referrer-policy/
Other
26 stars 27 forks source link

Strip referrer information from non-secure requests. #126

Open mikewest opened 5 years ago

mikewest commented 5 years ago

It's good to have dreams.


Preview | Diff

mikewest commented 5 years ago

(This is a bit difficult to ship, as we have anecdotal evidence that stripping referrers entirely breaks some sites' anti-CSRF mechanisms. A safer alternative (in the less-data-flowing-over-non-secure-wires sense) could be to adopt Brave's model of spoofing the referer header as the target's origin for non-secure resources.)

fmarier commented 5 years ago

Brave's model of spoofing the referer header as the target's origin for non-secure resources

The exact model we converged on is:

The problem with spoofing navigation is that while it's making the CSRF checks pass, it's also effectively disabling that check entirely (it always passes), which is not great for security.

Stripping referrers from iframes leads to a lot of breakage in our experience.

ericlaw1979 commented 4 years ago

@fmarier: Current versions of brave (e.g. 1.5.86 Chromium: 80.0.3987.87 (Official Build) dev (64-bit)) seem to do something slightly different:

Is that expected?

Test page: https://www.webdbg.com/test/refer/ image

fmarier commented 4 years ago

@ericlaw1979 Indeed that's the correct behavior. You're right I forgot to mention that our "origin" checks are actually ETLD+1 checks.

I made a test page for this specific behavior and have updated our documentation.