Repository navigation
fix(recovery): do not open an account recovery request unless the owner was notified - #498
Merged
Merged
Conversation
…er was notified The delay only protects an owner who is told about it, and the opening notice is the only place the cancel token is delivered. A request now opens only once a notice reaches a verified address; otherwise it is voided and /recovery/verify answers 503 recovery_notice_failed. Other open requests are cancelled only after the notice is sent, so an unannounced request cannot cancel the owner's. Closes #497
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.
Closes #497.
Self-service recovery relies on its delay and the "recovery opened" notice. The notice is the only place the cancel token is delivered. Until now,
/recovery/verifyopened the request even when every notice was skipped (external delivery) or failed (no direct transport, provider outage). So the delay could run out without the owner ever being told.Changes
verifyAccountRecoverykeeps the request only if at least one notice to a verified address wassent. OtherwisevoidUnannouncedRecoveryvoids it (and clears the cancel token hash), logsaccount_recovery_failedwith reasonOwner could not be notifiedand the notice outcomes, and answers503 { error: 'recovery_notice_failed' }.supersedeOtherRecoveries, only after a notice is sent, so a request the owner never heard about cannot cancel theirs./recovery/verifydocuments the503in its OpenAPI responses (regeneratedopenapi.json/src/generated/api.ts).The resume path is unchanged. A request that opened was announced, and resuming keeps its clock and sends no new notice.
Contract note
/recovery/verifygains a503withrecovery_notice_failed. This is unreleased (v0.20) and no adapter passes/recovery/*through yet, so it goes into the seamless-auth-server#232 work. Deployments that deliver codes through their adapter can still use recovery as long as the API has a working transport for the notice and the adapter does not request external delivery on verify.The rest of #497 needs a new delivery contract, so it is left for a
@seamless-auth/typesminor alongside the adapter wave:Checks
npm run typecheck,npm run lint,npm run format:check: passnpm run coverage: 2338 passed, all files 98.88 / 95.26 / 99.23 / 99.1tests/postgres/accountRecovery.spec.ts, including the new supersede/void case, run against a scratch Postgres with the full migration chain: 3 passed