Page MenuHomePhabricator

Be more strict about "Location:" redirects
ClosedPublic

Authored by epriestley on Aug 18 2014, 8:14 PM.
Tags
None
Referenced Files
F14061985: D10291.diff
Mon, Nov 18, 9:39 AM
F14049052: D10291.diff
Thu, Nov 14, 10:43 AM
F14037152: D10291.diff
Sun, Nov 10, 2:05 PM
F14021889: D10291.diff
Wed, Nov 6, 1:16 PM
F14009150: D10291.id24783.diff
Wed, Oct 30, 11:00 AM
F14009149: D10291.id24779.diff
Wed, Oct 30, 11:00 AM
F14005366: D10291.diff
Sun, Oct 27, 12:17 PM
F13993839: D10291.id.diff
Wed, Oct 23, 1:45 AM
Subscribers

Details

Reviewers
btrahan
Commits
Restricted Diffusion Commit
rPdf361470c1d9: 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.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Be more strict about "Location:" redirects.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.

It's possible that I missed an AphrontRedirectResponse somewhere which takes an external URI -- we have a lot of them, and I tried to review them all but there are seriously like a billion.

If I did, users will hit an exception about remote vs local redirects. The fix is to add ->setIsExternal(true) to the AphontRedirectResponse to mark it as external.

(The OAuth server uses a <form /> that users explicitly click nowadays, which is why doesn't get marked in this diff.)

btrahan edited edge metadata.
This revision is now accepted and ready to land.Aug 18 2014, 8:31 PM
epriestley updated this revision to Diff 24783.

Closed by commit rPdf361470c1d9 (authored by @epriestley).