Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip referrer information from non-secure requests. #126

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikewest
Copy link
Member

@mikewest mikewest commented Oct 17, 2019

It's good to have dreams.


Preview | Diff

@mikewest
Copy link
Member Author

(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
Copy link
Member

fmarier commented Oct 17, 2019

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

The exact model we converged on is:

  • cross-origin requests for iframes and sub-resources have their referrer set to be the origin of the requested resource ("spoofing")
  • cross-origin navigations have no referrer at all ("stripping")
  • same-origin requests of all kinds keep their normal referrer

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
Copy link
Contributor

@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:

  • cross-site requests for iframes and sub-resources have their referrer set to be the origin of the requested resource ("spoofing")
  • cross-site navigations have no referrer at all ("stripping")
  • same-site requests of all kinds keep their normal referrer

Is that expected?

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

@fmarier
Copy link
Member

fmarier commented Feb 11, 2020

@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.

Base automatically changed from master to main February 16, 2021 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants