-
-
Notifications
You must be signed in to change notification settings - Fork 509
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
feat(core): guard one-time token on consent request #7160
base: master
Are you sure you want to change the base?
feat(core): guard one-time token on consent request #7160
Conversation
COMPARE TO
|
Name | Diff |
---|---|
packages/core/src/middleware/koa-consent-guard.test.ts | 📈 +2.79 KB |
packages/core/src/middleware/koa-consent-guard.ts | 📈 +1.42 KB |
packages/core/src/tenants/Tenant.ts | 📈 +191 Bytes |
packages/experience/src/App.tsx | 📈 +198 Bytes |
packages/experience/src/pages/OneTimeToken/index.tsx | 📈 +55 Bytes |
packages/experience/src/pages/Register/index.tsx | 📈 +242 Bytes |
packages/experience/src/pages/SignIn/index.tsx | 📈 +280 Bytes |
packages/experience/src/pages/SwitchAccount/index.module.scss | 0 Bytes |
packages/experience/src/pages/SwitchAccount/index.tsx | 📈 +496 Bytes |
packages/experience/src/utils/search-parameters.ts | 📈 +428 Bytes |
90ba6bf
to
7a6309d
Compare
const interactionDetails = await provider.interactionDetails(ctx.req, ctx.res); | ||
const { | ||
params: { token, login_hint: loginHint }, | ||
session, | ||
} = interactionDetails; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there is a koa-interaction-details
middleware
session, | ||
} = interactionDetails; | ||
|
||
assertThat(session, new errors.SessionNotFound('session not found')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use RequestError('session.not_found')
?
import assertThat from '../utils/assert-that.js'; | ||
|
||
/** | ||
* Guard before allowing auto-consent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need some comments here, this middleware should guard one-time-token sign-in only.
await libraries.oneTimeTokens.verifyOneTimeToken(token, loginHint); | ||
} catch (error: unknown) { | ||
if (error instanceof RequestError) { | ||
if (error.code === 'one_time_token.email_mismatch') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should reject the sign-in request when login_hint
does not match with the value stored in token
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updates are needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix the email miss match error handling logic.
c5a27fc
to
402e351
Compare
7a6309d
to
4ae5524
Compare
1ccae5f
to
f5bbc6e
Compare
e213767
to
7806877
Compare
7806877
to
1f073e0
Compare
Summary
one_time_token
param is presented in the URL. The logic is now handled separately in both/sign-in
and/register
routes.Testing
Local dev test
Checklist
.changeset