Page MenuHomePhabricator

Only require POST to fetch file data if the viewer is logged in
ClosedPublic

Authored by epriestley on Apr 4 2017, 4:10 PM.
Tags
None
Referenced Files
F18824779: D17613.id.diff
Thu, Oct 23, 5:54 PM
F18820651: D17613.diff
Wed, Oct 22, 4:28 PM
F18773773: D17613.id42377.diff
Thu, Oct 9, 12:33 PM
F18761609: D17613.diff
Mon, Oct 6, 3:22 PM
F18527562: D17613.diff
Sep 6 2025, 7:05 PM
F18508699: D17613.id.diff
Sep 5 2025, 2:58 AM
F18500809: D17613.diff
Sep 4 2025, 9:21 PM
F18186138: D17613.id.diff
Aug 16 2025, 5:52 PM
Subscribers
None

Details

Summary

Ref T11357. In D17611, I added file.search, which includes a "dataURI". Partly, this is building toward resolving T8348.

However, in some cases you can't GET this URI because of a security measure:

  • You have not configured security.alternate-file-domain.
  • The file isn't web-viewable.
  • (The request isn't an LFS request.)

The goal of this security mechanism is just to protect against session hijacking, so it's also safe to disable it if the viewer didn't present any credentials (since that means there's nothing to hijack). Add that exception, and reorganize the code a little bit.

Test Plan
  • From the browser (with a session), tried to GET a binary data file. Got redirected.
  • Got a download with POST.
  • From the CLI (without a session), tried to GET a binary data file. Go a download.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Apr 4 2017, 6:00 PM
This revision was automatically updated to reflect the committed changes.