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

[hackerone] Strip referrer and origin in cross-origin requests from a .onion origin #18071

Closed
fmarier opened this issue Sep 13, 2021 · 5 comments · Fixed by brave/brave-core#10760

Comments

@fmarier
Copy link
Member

fmarier commented Sep 13, 2021

If a cross-origin request originates from a .onion service, we should match the Tor Browser behavior and:

  • omit the Referer header
  • send a value of null for the Origin header whenever present (e.g. in the case of a POST request)

Same-origin requests should follow our normal referrer policy.

Test page: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html

@fmarier fmarier added OS/Android Fixes related to Android browser functionality OS/Desktop labels Sep 13, 2021
@diracdeltas diracdeltas changed the title Strip referrer and origin in cross-origin requests from a .onion origin [hackerone] Strip referrer and origin in cross-origin requests from a .onion origin Sep 14, 2021
@diracdeltas
Copy link
Member

hackerone issue: https://hackerone.com/reports/1337624 (credit: kkarfalcon)

@fmarier fmarier self-assigned this Sep 18, 2021
@fmarier fmarier added the priority/P2 A bad problem. We might uplift this to the next planned release. label Sep 18, 2021
@fmarier fmarier added QA/Yes release-notes/include and removed OS/Android Fixes related to Android browser functionality labels Oct 29, 2021
@LaurenWags
Copy link
Member

LaurenWags commented Nov 30, 2021

Verified using

Brave | 1.33.94 Chromium: 96.0.4664.45 (Official Build) beta (x86_64)
-- | --
Revision | 76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}
OS | macOS Version 11.6.1 (Build 20G224)
Sub-resources

Same-origin

Test Case #1

onion16_1.png - was loaded with the full Referer header and the origin of this page in the Origin header.
  • Origin: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html
sub resources same-origin 1

Test Case #2

onion16_2.png - was loaded with a full Referer header and without an Origin header.
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html
sub resources same-origin 2

Test Case #3

onion16_3.png - was loaded with a full Referer header and the origin of this page in the Origin header.
  • Origin: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html
sub resources same-origin 3

Cross-origin

Test Case #1

onion16_4.png - was loaded without a Referer header and with a value of null in the Origin header.
  • origin: null
sub resources cross origin 4

Test Case #2

onion16_5.png - was loaded without Referer or Origin headers.
sub resources cross origin 5

Test Case #3

onion16_6.png - was loaded without a Referer header and a value of null in the Origin header.
sub resources cross origin 6
Navigations

Same-origin

The Referer header should be present (full URL of this page) in this example:

Test Case #1 - after a same-origin GET navigation

Nav same origin 1

Test Case #2 - after a same-origin GET navigation ending up in a redirect

Nav same origin 2
The Referer and Origin headers should be present (full URL, and same hostname as this page, respectively) in all of these examples:

Test Case #1 - after a same-origin POST navigation

Nav same origin 3

Test Case #2 - after a POST navigation ending up in a redirect

Nav same origin 4

Cross-origin

Neither the Referer not the Origin header should be present in these examples:

Test Case #1 - after a cross-origin GET navigation

Nav cross origin 1

Test Case #2 - after a same-origin GET navigation ending up in a cross-origin redirect

Nav cross origin 2

Test Case #3 - after a cross-origin GET navigation ending up in a same-origin redirect

Nav cross origin 3
The Referer header should not be present and the Origin header should be null in all of these examples:

Test Case #1 - after a cross-origin POST navigation

Nav cross origin 4

Test Case #2 - after a same-origin POST navigation ending up in a cross-origin redirect

Nav cross origin 5

Test Case #3 - after a cross-origin POST navigation ending up in a same-origin redirect

Nav cross origin 6

@LaurenWags LaurenWags added QA Pass-macOS and removed QA/In-Progress Indicates that QA is currently in progress for that particular issue labels Dec 1, 2021
@stephendonner stephendonner added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Dec 1, 2021
@stephendonner
Copy link

stephendonner commented Dec 1, 2021

Verification PASSED using

Brave 1.33.95 Chromium: 96.0.4664.45 (Official Build) dev (64-bit)
Revision 76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}
OS Linux
Sub-resources

Same-origin

Test Case #1

onion16_1.png - was loaded with the full Referer header and the origin of this page in the Origin header.
  • Origin: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html
Screen Shot 2021-12-01 at 11 40 39 AM

Test Case #2

onion16_2.png - was loaded with a full Referer header and without an Origin header.
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html
Screen Shot 2021-12-01 at 11 41 15 AM

Test Case #3

onion16_3.png - was loaded with a full Referer header and the origin of this page in the Origin header.
  • Origin: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html
Screen Shot 2021-12-01 at 11 41 41 AM

Cross-origin

Test Case #1

onion16_4.png - was loaded without a Referer header and with a value of null in the Origin header.
  • origin: null
Screen Shot 2021-12-01 at 11 42 42 AM

Test Case #2

onion16_5.png - was loaded without Referer or Origin headers.
Screen Shot 2021-12-01 at 1 02 37 PM

Test Case #3

onion16_6.png - was loaded without a Referer header and a value of null in the Origin header.
Screen Shot 2021-12-01 at 1 00 28 PM
Navigations

Same-origin

The Referer header should be present (full URL of this page) in this example:

Test Case #1 - after a same-origin GET navigation

Screen Shot 2021-12-01 at 1 06 19 PM

Test Case #2 - after a same-origin GET navigation ending up in a redirect

Screen Shot 2021-12-01 at 1 06 45 PM
The Referer and Origin headers should be present (full URL, and same hostname as this page, respectively) in all of these examples:

Test Case #1 - after a same-origin POST navigation

Screen Shot 2021-12-01 at 1 07 59 PM

Test Case #2 - after a POST navigation ending up in a redirect

Screen Shot 2021-12-01 at 1 08 14 PM

Cross-origin

Neither the Referer not the Origin header should be present in these examples:

Test Case #1 - after a cross-origin GET navigation

Screen Shot 2021-12-01 at 1 11 01 PM

Test Case #2 - after a same-origin GET navigation ending up in a cross-origin redirect

Screen Shot 2021-12-01 at 1 11 32 PM

Test Case #3 - after a cross-origin GET navigation ending up in a same-origin redirect

Screen Shot 2021-12-01 at 1 12 20 PM
The Referer header should not be present and the Origin header should be null in all of these examples:

Test Case #1 - after a cross-origin POST navigation

Screen Shot 2021-12-01 at 1 13 55 PM

Test Case #2 - after a same-origin POST navigation ending up in a cross-origin redirect

Screen Shot 2021-12-01 at 1 14 12 PM

Test Case #3 - after a cross-origin POST navigation ending up in a same-origin redirect

Screen Shot 2021-12-01 at 1 14 27 PM

@stephendonner stephendonner added QA Pass-Linux and removed QA/In-Progress Indicates that QA is currently in progress for that particular issue labels Dec 1, 2021
@stephendonner
Copy link

stephendonner commented Dec 2, 2021

Verification PASSED using

Brave 1.33.98 Chromium: 96.0.4664.55 (Official Build) (64-bit)
Revision 38cededc5d09b785d12203f1d3209aa6eb293e79-refs/branch-heads/4664@{#1090}
OS Windows 10 Version 20H2 (Build 19042.1348)
Sub-resources

Same-origin

Test Case #1

onion16_1.png - was loaded with the full Referer header and the origin of this page in the Origin header.
  • Origin: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html

18071-1

Test Case #2

onion16_2.png - was loaded with a full Referer header and without an Origin header.
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html

18071-2

Test Case #3

onion16_3.png - was loaded with a full Referer header and the origin of this page in the Origin header.
  • Origin: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion
  • Referer: http://ixrdj3iwwhkuau5tby5jh3a536a2rdhpbdbu6ldhng43r47kim7a3lid.onion/referrer/onion.html

18071-3

Cross-origin

Test Case #1

onion16_4.png - was loaded without a Referer header and with a value of null in the Origin header.
  • origin: null

18071-4

Test Case #2

onion16_5.png - was loaded without Referer or Origin headers.

18071-5

Test Case #3

onion16_6.png - was loaded without a Referer header and a value of null in the Origin header.

18071-6

Navigations

Same-origin

The Referer header should be present (full URL of this page) in this example:

Test Case #1 - after a same-origin GET navigation

18071-7

Test Case #2 - after a same-origin GET navigation ending up in a redirect

18071-8

The Referer and Origin headers should be present (full URL, and same hostname as this page, respectively) in all of these examples:

Test Case #1 - after a same-origin POST navigation

18071-9

Test Case #2 - after a POST navigation ending up in a redirect

18071-10

Cross-origin

Neither the Referer not the Origin header should be present in these examples:

Test Case #1 - after a cross-origin GET navigation

18071-11

Test Case #2 - after a same-origin GET navigation ending up in a cross-origin redirect

18071-12

Test Case #3 - after a cross-origin GET navigation ending up in a same-origin redirect

18071-13

The Referer header should not be present and the Origin header should be null in all of these examples:

Test Case #1 - after a cross-origin POST navigation

18071-14

Test Case #2 - after a same-origin POST navigation ending up in a cross-origin redirect

18071-15

Test Case #3 - after a cross-origin POST navigation ending up in a same-origin redirect

18071-17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants