2FA screens: the back link is checked on the server (twoFactor.safeBack)
@clocklimited/payload-2fa sends the browser to the `back` query value after a valid code without checking it (GHSA-rffw-fq79-g3ch upstream, not fixed in the fork): a prepared link ran script in the panel or left the site. SafeTotpView now stands in front of the package's setup and verify views and passes on a checked value: a path on the site's origin inside the admin route, else the admin root. The package's views stay in the import map through admin.dependencies, so ipal-kit still never imports the package. twoFactor.safeBack: false turns it off, a function replaces the rule; safeAdminBack, wrapTotpViews and SafeTotpView are exported. Projects with 2FA must regenerate the admin import map. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
39309c5c1c
commit
93e75426ab
@@ -23,6 +23,7 @@ import type { FormsOption } from './modules/forms/types.js'
|
||||
import type { RevalidatePathFn } from './modules/hooks/buildRevalidateHook.js'
|
||||
import type { I18nConfig } from './modules/i18n/types.js'
|
||||
import type { PagesOption } from './modules/pages/types.js'
|
||||
import type { SafeBackRule } from './modules/security/totp/safeBack.js'
|
||||
import type { VerifyLimitOptions } from './modules/security/totp/verifyLimit.js'
|
||||
import type { SeoOption } from './modules/seo/types.js'
|
||||
import type { StatsOptions } from './modules/stats/collection.js'
|
||||
@@ -265,6 +266,17 @@ export type IpalOptions = {
|
||||
* (then set `x-pathname` on /admin yourself). Run generate:importmap.
|
||||
*/
|
||||
provider?: false | PayloadComponent
|
||||
/**
|
||||
* Check on the `back` query value of the 2FA setup and verify screens. The
|
||||
* 2FA package sends the browser there after a valid code without looking at
|
||||
* it, so a crafted link could run script in the panel (`javascript:`) or
|
||||
* leave the site. On by default: ipal-kit's `SafeTotpView` goes in front of
|
||||
* the package's views and passes on a value that stays on the site's origin,
|
||||
* inside the admin route — anything else becomes the admin root
|
||||
* (`safeAdminBack`). A function replaces the rule; `false` leaves the
|
||||
* package's views as they are. Run generate:importmap. docs/security.md.
|
||||
*/
|
||||
safeBack?: false | SafeBackRule
|
||||
/**
|
||||
* Texts of the 2FA screens and user field. Default: ipal-kit's English and
|
||||
* Polish (`TOTP_TEXTS`), merged over the package's; your own
|
||||
|
||||
Reference in New Issue
Block a user