1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-24 07:42:40 +01:00
phorge-phorge/src/applications/files/format
epriestley d450a08890 Support HMAC+SHA256 with automatic key generation and management
Summary:
Ref T12509. This adds support for HMAC+SHA256 (instead of HMAC+SHA1). Although HMAC+SHA1 is not currently broken in any sense, SHA1 has a well-known collision and it's good to look at moving away from HMAC+SHA1.

The new mechanism also automatically generates and stores HMAC keys.

Currently, HMAC keys largely use a per-install constant defined in `security.hmac-key`. In theory this can be changed, but in practice essentially no install changes it.

We generally (in fact, always, I think?) don't use HMAC digests in a way where it matters that this key is well-known, but it's slightly better if this key is unique per class of use cases. Principally, if use cases have unique HMAC keys they are generally less vulnerable to precomputation attacks where an attacker might generate a large number of HMAC hashes of well-known values and use them in a nefarious way. The actual threat here is probably close to nonexistent, but we can harden against it without much extra effort.

Beyond that, this isn't something users should really have to think about or bother configuring.

Test Plan:
  - Added unit tests.
  - Used `bin/files integrity` to verify, strip, and recompute hashes.
  - Tampered with a generated HMAC key, verified it invalidated hashes.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12509

Differential Revision: https://secure.phabricator.com/D17630
2017-04-06 15:42:59 -07:00
..
__tests__ Support "Range: bytes=123-" requests 2017-04-05 11:25:44 -07:00
PhabricatorFileAES256StorageFormat.php Support HMAC+SHA256 with automatic key generation and management 2017-04-06 15:42:59 -07:00
PhabricatorFileRawStorageFormat.php Add support to Files for file storage formats, to support encryption-at-rest 2016-06-15 11:17:53 -07:00
PhabricatorFileROT13StorageFormat.php Add support to Files for file storage formats, to support encryption-at-rest 2016-06-15 11:17:53 -07:00
PhabricatorFileStorageFormat.php Store and verify content integrity checksums for files 2017-04-05 11:12:31 -07:00