HomePhabricator

Be more strict about "Location:" redirects

Description

Be more strict about "Location:" redirects

Summary:
Via HackerOne. Chrome (at least) interprets backslashes like forward slashes, so a redirect to "/\evil.com" is the same as a redirect to "//evil.com".

  • Reject local URIs with backslashes (we never generate these).
  • Fully-qualify all "Location:" redirects.
  • Require external redirects to be marked explicitly.

Test Plan:

  • Expanded existing test coverage.
  • Verified that neither Diffusion nor Phriction can generate URIs with backslashes (they are escaped in Diffusion, and removed by slugging in Phriction).
  • Logged in with Facebook (OAuth2 submits a form to the external site, and isn't affected) and Twitter (OAuth1 redirects, and is affected).
  • Went through some local redirects (login, save-an-object).
  • Verified file still work.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D10291

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Aug 18 2014, 9:11 PM
Reviewer
btrahan
Differential Revision
D10291: Be more strict about "Location:" redirects
Parents
rPfe042def42b0: Add a Javascript method to find the pixel position of a range in a textarea
Branches
Unknown
Tags
Unknown