HomePhabricator

Add support to Files for file storage formats, to support encryption-at-rest

Description

Add support to Files for file storage formats, to support encryption-at-rest

Summary:
Ref T11140. When reading and writing files, we optionally apply a "storage format" to them.

The default format is "raw", which means we just store the raw data.

This change modularizes formats and adds a "rot13" format, which proves formatting works and is testable. In the future, I'll add real encryption formats.

Test Plan:

  • Added unit tests.
  • Viewed files in web UI.
  • Changed a file's format to rot13, saw the data get rotated on display.
  • Set default format to rot13:
    • Uploaded a small file, verified data was stored as rot13.
    • Uploaded a large file, verified metadata was stored as "raw" (just a type, no actual data) and blob data was stored as rot13.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11140

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

Details