2FA setup required: review fixes (SR-1 to SR-9)
SR-1: /api/ipal/admin-icon sends the upload security headers (sandbox policy, nosniff) with the bytes: an SVG is shown, never run. fetchPublicImage stops reading at the size limit. SR-2: requireSetup.exempt exempts only on exactly true; an async function, and a windowHours that is not a number or false, stop the start. SR-3: on Postgres / SQLite the missing column makes every login fail: the log says so, the docs call the migration a required step of the same deploy, and ipal-doctor reports a SQL project without it. SR-4: an admin's reset also ends the account's sessions. SR-5: the reset needs a session that entered its own TOTP code by default. SR-6: the doctor's import-map rule covers TwoFactorStatusField and TwoFactorAlert. SR-7: building blocks exported; dashboard notice, status field, setup notice and the server-side image fetch can be switched off one by one. SR-8: totpSetupFrom is on the 2FA collection whenever 2FA is on. SR-9: both ways out of "every administrator is blocked" in security.md. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
9d2ab43438
commit
75a6f5209e
@@ -27,6 +27,8 @@ import { publicImageDataUri, siteOrigin } from './publicImage.js'
|
||||
type BrandingProps = {
|
||||
/** Upload field to render as the image. Default 'logo' (Logo) / 'favicon' (Icon). */
|
||||
imageField?: string
|
||||
/** `whiteLabel.inlineImages: false` — never fetch the image on the server for the 2FA screens. */
|
||||
inlineImages?: false
|
||||
/** Injected by Payload — current admin locale (object or code). */
|
||||
locale?: { code?: string } | string
|
||||
/** Field holding the site name. Default 'siteName'. */
|
||||
@@ -78,7 +80,7 @@ async function loadBranding(
|
||||
// other collection, so the browser would show a broken image on the verify / setup screens.
|
||||
// Give it the picture itself, fetched as an anonymous visitor would get it; when that fails
|
||||
// (media is not public), the site name is shown instead.
|
||||
if (url && props.user && !secondFactorPassed({ payload, user: props.user })) {
|
||||
if (url && props.inlineImages !== false && props.user && !secondFactorPassed({ payload, user: props.user })) {
|
||||
return { name, url: await publicImageDataUri(url, siteOrigin(payload.config.serverURL)) }
|
||||
}
|
||||
return { name, url }
|
||||
|
||||
Reference in New Issue
Block a user