ipal-doctor: the raw 2FA view warning only for a view component

R3-1: the warning fired on any mention of the 2FA package's setup / verify view
in the config, so it stayed after the fix its own text suggests (SafeTotpView
with the path as ipalTotpView, plus the path in admin.dependencies). It now
warns only when the path is a view's Component.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-24 17:49:06 +01:00
co-authored by Claude Fable 5.2
parent b2c1dca5da
commit 3eee841dd0
4 changed files with 34 additions and 12 deletions
+4 -2
View File
@@ -204,11 +204,13 @@ export const layoutRules: DoctorRule[] = [
}
}
// A view the project registers itself with the 2FA package's own component is not behind the back-link check.
if (/@clocklimited\/payload-2fa\/rsc#TOTP(?:Setup|Verify)/.test(cfg)) {
// Only as a view's component (`Component: '<path>'` or `Component: { path: '<path>' }`): the same path as the
// value of `ipalTotpView` or of an `admin.dependencies` entry is the fix, not the problem.
if (/\bComponent\s*:\s*(?:\{[^{}]*?\bpath\s*:\s*)?['"`]@clocklimited\/payload-2fa\/rsc#TOTP(?:Setup|Verify)\b/.test(cfg)) {
out.push({
file: configFile(ctx) ?? undefined,
fix: "register it through wrapTotpViews (or Component: { path: '@intecion/ipal-kit/admin#SafeTotpView', serverProps: { ipalTotpView: '<that path>' } } plus the path in admin.dependencies) — security.md \"Your own 2FA screen\"",
message: "the config names the 2FA package's own setup / verify view: a view registered that way sends the browser to an unchecked `back` link after the code",
message: "the config registers the 2FA package's own setup / verify view as a view component: it sends the browser to an unchecked `back` link after the code",
severity: 'warning',
})
}