2FA back link: review fixes — views guarded by object, client views, a loud stale import map

SB-1: the 2FA package replaces a view that already stands under its keys, so a
key that existed before the factory ran was wrongly treated as the project's own
and left unguarded (also with a double registration, or ipalKit over its own
output). Views are now compared by object, right after the factory.

SB-2: SafeTotpView renders through Payload's RenderServerComponent: a client
component set as a 2FA view gets only client props plus the checked back.

SB-3: a production build with the previous import map shows an empty 2FA screen.
twoFactor.importMapCheck (on, production only) reads the committed map at start:
an error in the log and a message on the 2FA screens. Docs name the real symptom.

SB-4: enabled: false restores admin.dependencies; wrapTotpViews keeps exportName.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-24 16:16:39 +01:00
co-authored by Claude Fable 5.2
parent 93e75426ab
commit ad51456eaa
21 changed files with 477 additions and 70 deletions
+9
View File
@@ -242,6 +242,15 @@ export type IpalOptions = {
* package version the check does not recognise; docs/security.md.
*/
guard?: false
/**
* Check, at start in production, that the committed admin import map has
* the entry `safeBack` needs (`@intecion/ipal-kit/admin#SafeTotpView`).
* Without it Payload renders the 2FA screens empty and nobody can sign in;
* with the check the server log says so at every start and the 2FA screens
* show a message instead of nothing. On by default; `false` skips the file
* read, the log line and the message.
*/
importMapCheck?: false
/** Name shown in the authenticator app (e.g. company/site name). */
issuer: string
/**