@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]>
20 lines
970 B
TypeScript
20 lines
970 B
TypeScript
export {
|
|
buildAdminCsp,
|
|
buildAdminCspHeaders,
|
|
buildCsp,
|
|
buildCspHeaders,
|
|
buildReportingEndpoints,
|
|
cspHeaderKey,
|
|
DEFAULT_CSP_REPORT_GROUP,
|
|
} from './buildCsp.js'
|
|
export type { BuildAdminCspArgs, BuildCspArgs, CspDirective, CspSources } from './buildCsp.js'
|
|
export { buildSecurityHeaders, buildUploadSecurityHeaders } from './buildSecurityHeaders.js'
|
|
export type { BuildSecurityHeadersArgs, SecurityHeader } from './buildSecurityHeaders.js'
|
|
export { createCspReportRoute, parseCspReports } from './createCspReportRoute.js'
|
|
export type { CreateCspReportRouteArgs, CspViolation } from './createCspReportRoute.js'
|
|
export { createCspNonce, CSP_NONCE_HEADER } from './cspNonce.js'
|
|
export { totpAdminPath, totpRedirectTarget } from './totp/totpRedirect.js'
|
|
export type { TotpRedirectArgs, TotpUser } from './totp/totpRedirect.js'
|
|
export { withSecurityConfig } from './withSecurityConfig.js'
|
|
export type { WithSecurityConfigOptions } from './withSecurityConfig.js'
|