Repository navigation
fix(plugin-auth): a reset link refused as a duplicate answers the uniform reset answer, not an empty 500 - #39787
objectstack-fleet[bot] wants to merge 5 commits into
Conversation
… reset answer Paused by the maintainer (p3 work paused); WIP pushed on his order. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CYxMdMFNAPYqMHvqBt
…known, add a burst pin The refused reset request answers exactly what a first request and an unknown address answer (status, media type, body), proven against a store that really refused the row; five concurrent requests answer the same and log no error. The runtime warning names its remedy instead of a tracker number, and the module header names the two doors this seam leaves alone (host secondaryStorage, the phone reset door) and why. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj
…engine read The engine strips `identifier` on read, so the one-row proof reads the sys_verification table itself. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj
…duplicate pins `check:test-source-alias` finds the reach into a dynamic `@objectstack/core/egress` import; pay it at module top, not inside a clocked case. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 602953d0201865e5cdd1ca3d6fce88b82df2fbfa && git checkout 602953d0201865e5cdd1ca3d6fce88b82df2fbfa
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 881809cf53e394c59704cb9ba100386fba74804a 07975ef04183c94469c52cd0fcbdd270ab68fcaf && git checkout -B drift-repro 881809cf53e394c59704cb9ba100386fba74804a && git merge --no-ff 07975ef04183c94469c52cd0fcbdd270ab68fcaf
node scripts/docs-audit/affected-docs.mjs --json 881809cf53e394c59704cb9ba100386fba74804a
|
Requested by Elon · project thread
Fixes #32645
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Takes over os-bill's paused work (one WIP commit) and finishes it.
packages/plugins/plugin-auth/src/reset-request-duplicate-refusal.ts(new): when the store refuses an emailed reset link'ssys_verificationrow (identifier prefixreset-password:) as a duplicate, the adapter answersnull. better-auth 1.7.29's/request-password-resetreads a falsycreateVerificationValueas a veto and answers the same200+ uniform body it gives a sent link and an unknown address. Any other object, any other verification row, and any other refusal rethrows exactly as before.objectql-adapter.tscreate: the one insert call routes throughinsertOrVetoResetLink.409would answer an address with an account differently from one without, which is the account-existence oracle the uniform answer exists to close.sys_verification.value) and carries no tracker number.secondaryStorage(better-auth still writes the cache copy of a vetoed row, so a cache-only link is mailed; the answer stays the uniform200), and the phone reset door (its rows carry a random code invalue, the phone's earlier row is deleted first, and a concurrent pair colliding on the derived row id is already recovered upstream bycreateOrFindVerification, which reads the driver error the engine keeps ascause).@objectstack/plugin-auth.Read first, by risk:
objectql-adapter.ts, thecreatehunk: the only line on a hot write path; everything except a reset link row must still throw.reset-request-duplicate-refusal.ts,isResetLinkRow/isDuplicateRefusal: the two predicates that bound the veto.reset-request-duplicate-refusal.test.ts, the "no existence oracle" case: the pin for the hard constraint.Tests
reset-request-duplicate-refusal.test.ts, against a real SQLite store carrying the leftoverUNIQUE(value)index, throughAuthManager.handleRequest:200every time, sends one mail, and logs no error;Focused file, head 07975ef: 8 passed
Ablation: the adapter call put back to a plain insert, 3 door pins red on the 500
Neighbouring reset, verification and adapter files: 17 files, 311 passed
Typecheck: green, test layer held at its ledger
NOT MEASURED: the full plugin-auth suite (299 files), reason: it does not finish inside the container's foreground cap; CI's
Test Corecarries it.Acceptance notes
secondaryStorage, a vetoed row's link is kept in the cache only and mailed; the answer is still the uniform200. Recorded in the module header and the changeset.databaseHooks.verification.create.afterhook receivesnullfor a vetoed row (better-auth runs the after-hooks with what create returned). The platform registers none onverification.node scripts/ci/snapshot-next.mjs --self-testexits 1 in this worktree on one stable-lane case; the diff does not touchscripts/.Verification
Derived gate families (dispatch-gates --commands, reconciled with --ran): 71 derived, 69 run, 2 NOT MEASURED, 0 unrun
Two-minute check:
pnpm --filter @objectstack/plugin-auth exec vitest run src/reset-request-duplicate-refusal.test.tsshows 8 passed; the "no existence oracle" case is the hard constraint.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj