fix(auth): drop ignored magicLink allowedAttempts option#319
Merged
Conversation
better-auth consumes magic-link tokens atomically on the first verification call, so allowedAttempts has no effect for any value other than 1 (GHSA-hc7v-rggr-4hvx). Remove the option to silence the startup warning.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Removes the
allowedAttempts: 3option from the magic-link plugin config.Why
better-auth consumes magic-link tokens atomically on the first verification call, so
allowedAttemptshas no effect for any value other than1(GHSA-hc7v-rggr-4hvx). The library now emits a startup warning for any non-default value.The option's original intent (per the comment it carried) was to tolerate Outlook Safe Links / Slack unfurl prefetching the link and burning the token before the human clicks. That concern is already handled elsewhere: the email links to the
/verify-magic-linkinterstitial, which only calls the token-consuming verify endpoint from a client-sideuseEffect. Non-browser scanners don't execute JS, so they never consume the token. Seeapps/web/src/routes/verify-magic-link.tsx.So the option was both non-functional (per the GHSA) and redundant with the interstitial. Dropping it is behaviour-preserving and silences the warning.