1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-04 11:51:02 +01:00
phorge-phorge/src/infrastructure
epriestley 1d34238dc9 Upgrade sessions digests to HMAC256, retaining compatibility with old digests
Summary:
Ref T13222. Ref T13225. We store a digest of the session key in the session table (not the session key itself) so that users with access to this table can't easily steal sessions by just setting their cookies to values from the table.

Users with access to the database can //probably// do plenty of other bad stuff (e.g., T13134 mentions digesting Conduit tokens) but there's very little cost to storing digests instead of live tokens.

We currently digest session keys with HMAC-SHA1. This is fine, but HMAC-SHA256 is better. Upgrade:

  - Always write new digests.
  - We still match sessions with either digest.
  - When we read a session with an old digest, upgrade it to a new digest.

In a few months we can throw away the old code. When we do, installs that skip upgrades for a long time may suffer a one-time logout, but I'll note this in the changelog.

We could avoid this by storing `hmac256(hmac1(key))` instead and re-hashing in a migration, but I think the cost of a one-time logout for some tiny subset of users is very low, and worth keeping things simpler in the long run.

Test Plan:
  - Hit a page with an old session, got a session upgrade.
  - Reviewed sessions in Settings.
  - Reviewed user logs.
  - Logged out.
  - Logged in.
  - Terminated other sessions individually.
  - Terminated all other sessions.
  - Spot checked session table for general sanity.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13225, T13222

Differential Revision: https://secure.phabricator.com/D19883
2018-12-13 16:15:38 -08:00
..
cluster Continue making application fixes to Phabricator for changes to %Q semantics 2018-11-15 03:50:02 -08:00
contentsource Redesign Config Application 2016-08-29 15:49:49 -07:00
customfield Allow "Change Subtype" to be selected from the comment action stack 2018-11-28 13:40:40 -08:00
daemon Move the "container updated" message for Buildables that build Diffs outside of the transaction 2018-11-16 12:34:06 -08:00
diff When authors add inlines to their own revisions/commits, mark them as "Done" by default 2018-09-07 11:18:14 -07:00
edges Continue making application fixes to Phabricator for changes to %Q semantics 2018-11-15 03:50:02 -08:00
env When building a config stack, stop SiteSource objects from poisoning the cache 2018-07-20 16:07:41 -07:00
events Modernize Hovercard implementation 2015-12-24 12:18:28 -08:00
export Allow "bin/bulk export" to merge multiple queries and accept more flexible flags 2018-10-10 09:14:14 -07:00
graph Enable hovercards for the "Task Graph" UI in Maniphest 2017-10-04 11:12:01 -07:00
internationalization Correct a mangled translation string in "bin/phd log --id X" 2018-10-26 06:13:18 -07:00
javelin When the profiler is active, keep it active if the user submits forms 2017-02-23 11:15:40 -08:00
lint/linter Linter fixes 2015-12-03 07:44:23 +11:00
log Add "%I" (instance name) to application log formats 2017-04-23 11:07:19 -07:00
management Provide "bin/files integrity" for debugging, maintaining and backfilling integrity hashes 2017-04-06 15:42:43 -07:00
markup Fix YouTube remarkup rule being blocked by Content-Security-Policy header 2018-04-02 16:11:02 -07:00
query Continue cleaning up queries in the wake of changes to "%Q" 2018-11-16 12:49:44 -08:00
sms Various linter fixes 2015-08-11 22:36:55 +10:00
ssh Generate a random unique "Request ID" for SSH requests so processes can coordinate better 2018-03-22 13:44:30 -07:00
status Give Drydock Leases more modern status treatment 2018-02-13 13:15:57 -08:00
storage Completely remove "LiskDAOSet" and "loadRelatives/loadOneRelative" 2018-12-12 16:41:51 -08:00
syntax Pass the new default syntax highlighting map to the remarkup engine 2016-05-05 02:51:19 -07:00
testing When running unit tests, ignore any custom task fields 2017-04-02 09:36:17 -07:00
time Fix errors found by PHPStan 2017-02-18 09:24:56 +00:00
util Upgrade sessions digests to HMAC256, retaining compatibility with old digests 2018-12-13 16:15:38 -08:00
PhabricatorEditor.php Mark some strings for translation 2015-06-09 23:06:52 +10:00