Fix the 2FA setup loop: setup-totp?back=null redirected to itself
@clocklimited/payload-2fa's admin provider reads the current path from an x-pathname request header. Nothing sets it on /admin (the createProxy matcher skips /admin), so the path was null: every admin page, the setup screen too, redirected to /admin/setup-totp?back=null, forever. Every new admin on a site with 2FA got stuck. ipalKit now swaps that provider for its own TotpRedirectProvider (@intecion/ipal-kit/admin, client-side): it reads the path in the browser, never redirects away from the setup/verify screens or logout, and renders nothing while redirecting. twoFactor.provider takes a project component, or false to keep the package's. totpRedirectTarget / totpAdminPath export the rules. Projects run generate:importmap. Test: test/totpRedirect.test.ts (redirect walk, provider swap). Dev app: IPAL_DEV_2FA=1 turns 2FA on. Docs: security.md, CHANGELOG (Unreleased), AGENT.md, ipal-setup/-upgrade/-debug/-reference, PROGRAMISTA item 51. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4e254057f9
commit
60f744e3ad
@@ -268,6 +268,8 @@ export {
|
||||
cspHeaderKey,
|
||||
DEFAULT_CSP_REPORT_GROUP,
|
||||
parseCspReports,
|
||||
totpAdminPath,
|
||||
totpRedirectTarget,
|
||||
withSecurityConfig,
|
||||
} from './modules/security/index.js'
|
||||
export type {
|
||||
@@ -277,6 +279,8 @@ export type {
|
||||
CspDirective,
|
||||
CspSources,
|
||||
CspViolation,
|
||||
TotpRedirectArgs,
|
||||
TotpUser,
|
||||
WithSecurityConfigOptions,
|
||||
} from './modules/security/index.js'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user