Page MenuHomePhabricator

Add "temporary tokens" to auth, for SMS codes, TOTP codes, reset codes, etc
ClosedPublic

Authored by epriestley on May 20 2014, 5:49 PM.
Tags
None
Referenced Files
F14059002: D9217.diff
Sun, Nov 17, 4:41 PM
F14048418: D9217.diff
Thu, Nov 14, 7:42 AM
F14037199: D9217.diff
Sun, Nov 10, 2:21 PM
F14018742: D9217.diff
Tue, Nov 5, 6:54 PM
F13999388: D9217.diff
Thu, Oct 24, 2:26 PM
F13994382: D9217.id.diff
Wed, Oct 23, 5:45 AM
F13989404: D9217.id21888.diff
Mon, Oct 21, 8:13 PM
F13989159: D9217.id21888.diff
Mon, Oct 21, 6:29 PM
Subscribers

Details

Summary

Ref T4398. We have several auth-related systems which require (or are improved by) the ability to hand out one-time codes which expire after a short period of time.

In particular, these are:

  • SMS multi-factor: we need to be able to hand out one-time codes for this in order to prove the user has the phone.
  • Password reset emails: we use a time-based rotating token right now, but we could improve this with a one-time token, so once you reset your password the link is dead.
  • TOTP auth: we don't need to verify/invalidate keys, but can improve security by doing so.

This adds a generic one-time code storage table, and strengthens the TOTP enrollment process by using it. Specifically, you can no longer edit the enrollment form (the one with a QR code) to force your own key as the TOTP key: only keys Phabricator generated are accepted. This has no practical security impact, but generally helps raise the barrier potential attackers face.

Followup changes will use this for reset emails, then implement SMS multi-factor.

Test Plan
  • Enrolled in TOTP multi-factor auth.
  • Submitted an error in the form, saw the same key presented.
  • Edited the form with web tools to provide a different key, saw it reject and the server generate an alternate.
  • Change the expiration to 5 seconds instead of 1 hour, submitted the form over and over again, saw it cycle the key after 5 seconds.
  • Looked at the database and saw the tokens I expected.
  • Ran the GC and saw all the 5-second expiry tokens get cleaned up.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Add "temporary tokens" to auth, for SMS codes, TOTP codes, reset codes, etc.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.

awesomesauce. feel free to take anything SMS related - I am in project / dashboard / workboard land for a few days at least yet.

This revision is now accepted and ready to land.May 20 2014, 6:15 PM
epriestley updated this revision to Diff 21899.

Closed by commit rPcac61980f904 (authored by @epriestley).