-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: impose expiry on auth code instead of magic link #1440
Conversation
just a question regarding the security, if the expiry only trigs after the usage unlike the 5min it has now, does it mean it will never expiry if I never use it? I thought the link behaves like the one time password in terms of the expiry strategy, but it seems like they are different. |
Hey @aboveyunhai, Thanks for the query - it will still expire but the expiry restriction will be controlled by Mailer OTP Expiry instead of flow state expiry and it will be constant across all link related flows |
ca03312
to
f374f87
Compare
f374f87
to
f665e51
Compare
🤖 I have created a release *beep* *boop* --- ## [2.145.0](v2.144.0...v2.145.0) (2024-03-26) ### Features * add error codes ([#1377](#1377)) ([e4beea1](e4beea1)) * add kakao OIDC ([#1381](#1381)) ([b5566e7](b5566e7)) * clean up expired factors ([#1371](#1371)) ([5c94207](5c94207)) * configurable NameID format for SAML provider ([#1481](#1481)) ([ef405d8](ef405d8)) * HTTP Hook - Add custom envconfig decoding for HTTP Hook Secrets ([#1467](#1467)) ([5b24c4e](5b24c4e)) * refactor PKCE FlowState to reduce duplicate code ([#1446](#1446)) ([b8d0337](b8d0337)) ### Bug Fixes * add http support for https hooks on localhost ([#1484](#1484)) ([5c04104](5c04104)) * cleanup panics due to bad inactivity timeout code ([#1471](#1471)) ([548edf8](548edf8)) * **docs:** remove bracket on file name for broken link ([#1493](#1493)) ([96f7a68](96f7a68)) * impose expiry on auth code instead of magic link ([#1440](#1440)) ([35aeaf1](35aeaf1)) * invalidate email, phone OTPs on password change ([#1489](#1489)) ([960a4f9](960a4f9)) * move creation of flow state into function ([#1470](#1470)) ([4392a08](4392a08)) * prevent user email side-channel leak on verify ([#1472](#1472)) ([311cde8](311cde8)) * refactor email sending functions ([#1495](#1495)) ([285c290](285c290)) * refactor factor_test to centralize setup ([#1473](#1473)) ([c86007e](c86007e)) * refactor mfa challenge and tests ([#1469](#1469)) ([6c76f21](6c76f21)) * Resend SMS when duplicate SMS sign ups are made ([#1490](#1490)) ([73240a0](73240a0)) * unlink identity bugs ([#1475](#1475)) ([73e8d87](73e8d87)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
What kind of change does this PR introduce?
Currently, we check for flow state expiry rather than auth code expiry. The auth code is created at the point when
/magiclink
is called and expiry starts from then. However, the auth code should probably start expiring when the link is verified and the auth code is issued.We can eventually extend this to other magic link like flows if need.
Note that the Flow State expiry is capped at 24 hours, as that is when the regular cleanup takes place. Considered adding a hard restriction on the maximum validity of
GOTRUE_MAILER_OTP_EXP
but there are a handful of projects which have it >86400.The handful of existing projects (number on internal channel) with a OTP expiry of longer than 24 hours will continue to have the expiry capped at 24 hours when using PKCE. This should be the same as the current behaviour since we aren't changing the cleanup duration.