Home GnuPG

Remove PhabricatorFile::buildFromFileDataOrHash()
873b39be8211Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Remove PhabricatorFile::buildFromFileDataOrHash()

Summary:
Ref T12464. This is a very old method which can return an existing file instead of creating a new one, if there's some existing file with the same content.

In the best case this is a bad idea. This being somewhat reasonable predates policies, temporary files, etc. Modern methods like newFromFileData() do this right: they share underlying data in storage, but not the actual File records.

Specifically, this is the case where we get into trouble:

  • I upload a private file with content "X".
  • You somehow generate a file with the same content by, say, viewing a raw diff in Differential.
  • If the diff had the same content, you get my file, but you don't have permission to see it or whatever so everything breaks and is terrible.

Just get rid of this.

Test Plan:

  • Generated an SSH key.
  • Viewed a raw diff in Differential.
  • (Did not test Phragment.)

Reviewers: chad

Reviewed By: chad

Subscribers: hach-que

Maniphest Tasks: T12464

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

Details

Provenance
epriestley <git@epriestley.com>Authored on Apr 4 2017, 11:26 PM
Parents
rPHAB45b386596e62: Make the Files "TTL" API more structured
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHAB873b39be8211: Remove PhabricatorFile::buildFromFileDataOrHash() (authored by epriestley <git@epriestley.com>).Apr 5 2017, 1:18 AM