Gate point before a verify creates a user
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- authentication
Research direction
Start in the verify flow around authenticateWithIdentifier, following the calls to userStore.create and identityStore.create, then read InitiateGate.onVerified and checkVerifiedGate. Decide between the onBeforeCreateUser hook and an onInitiate silentRefuse decision before writing anything. Done means the gate is consulted before any user or identity row is written, a refused correct code returns the same error as a wrong one without clearing the auth_challenge cookie, and isNewUser is documented.
Written by the indexing model from the issue text.
Description
InitiateGate.onVerified runs after authenticateWithIdentifier has already called userStore.create and identityStore.create. An app that answers every initiate the same way, so its form doesn't reveal who has an account, still gets a live code stored for an address it won't serve. If someone guesses that code, the account is created before the gate is asked. To refuse it, the app has to delete rows the library just wrote. Two verifies of the same code can also both get past the challenge and reach that sequence together, so the app can't use "I inserted this row" to mean "this account is new". It needs its own approval mark.
Ask, either of:
- A hook such as
gate.onBeforeCreateUser({ provider, identifier, request }), called inauthenticateWithIdentifierbeforeuserStore.create. Its{ error }fails the verify like a bad code. - An
onInitiatedecision such as"silentRefuse": no challenge is stored and no email is sent, but the answer is the same as for an accepted initiate (status, redirect, and a challenge cookie of the same shape).
Also: when onVerified answers { error }, send that error without the provider's cookie that clears auth_challenge (checkVerifiedGate adds it today). If the cookie is cleared, a refused correct code doesn't answer like a wrong one: the next post from that browser gets "Verification not found" instead of "Incorrect code", which shows the guess was right and the address isn't served.
Also worth documenting: isNewUser means "no identity existed", not "the user row is new", which matters for a user store that upserts.
Found while building invites in activescott/four-in-a-row (security reviews on activescott/four-in-a-row#42). That app works around this today with an approved_at column that only onVerified sets.
Milestone: Private Beta, because an invite-only app is exactly the case this affects.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 2
- Avg merge
- 11d 7h
- Merged PRs (30d)
- 10
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from activescott/auth
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
activescott/auth#193 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
activescott/auth#54 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
activescott/auth#38 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
activescott/auth#211 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
activescott/auth#197 ·
Maintainers usually reply within 1 day
All issues in activescott/auth
Similar issues
-
accessibility area:ci ci-test level:low priority:high type:test
Difficulty 2/5 1-3 hours Newbie friendliness 71/100
skytuhua-org/Gen-V1#3132 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
drmrd/vernacular#1238 ·
Maintainers usually reply within 1 day
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
enhancement migration-prioritized
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Hudson-Pufferfish/local-party-console#136 ·
Maintainers usually reply within 1 day
-
priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day