Repository navigation
feat(customers): hashed single-use verification codes and guarded order alerts - #145
Merged
Merged
Conversation
…er alerts Every SMS code the storefront sends is issued hashed (HMAC on the row, 10 minute expiry, plain code only in the message), and create, verify-code, confirm-account-closure and verify-phone-number check the newest live code for the identity or user with core's check() and use it up with consume(), so a code verifies once and a leaked table gives nothing away. StorefrontOrderCreated sends its text through core's SmsServiceChannel so order alerts are budgeted and ledgered. Everything falls back to the old behaviour on a core without these APIs.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 1 of the SMS guard on the storefront side, on top of #144 (phase 0). Pairs with fleetbase/core-api#307.
request-creation-code,login-with-sms,account-closure,request-phone-verification) is issued with core'shashedoption: the row keeps an HMAC, the code expires in 10 minutes, and the plain code exists only in the message.create,verify-code,confirm-account-closureandverify-phone-numberlook up the newest live code for the identity or user (findActiveFor/findActiveForSubject), check it withcheck()(locks after 5 wrong guesses) and use it up withconsume(). A code can no longer verify twice, and a leaked table no longer gives away live codes.StorefrontOrderCreatedsends its text through core'sSmsServiceChannel(purposestorefront_order_alert), so it is budgeted and on the ledger like every other message.Compatibility
Works against the current core release: on a core without
findActiveFor,consumeorSmsServiceChannel(before 1.6.70) the controller falls back to the plain lookups it had, thehashedoption is ignored (plaintext codes as today), and the order alert keeps the Twilio channel. Nothing changes for apps in the field; codes in flight at deploy time keep verifying.Merge order
Based on
feature/sms-guardso the diff shows only phase 1. Before merging #144, retarget this PR torelease/v0.4.25; otherwise GitHub closes it when the base branch is deleted.Tests
The notification contract test covers the channel switch and
toSms. The code-check paths are exercised by the existing contract tests (plaintext fixture rows still verify through the legacy comparison incheck()) and the lockout tests from phase 0. Not run locally (the local runner is silent on this machine); storefront CI does not run for release-branch PRs.Docs
fleetbase/postman: codes now expire after 10 minutes and verify once.needs-docs,needs-api-spec.