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
@@ -161,9 +161,14 @@ export function buildUploadSecurityHeaders({ collections = ['media'] }: { collec
|
||||
headers: SecurityHeader[]
|
||||
source: string
|
||||
}[] {
|
||||
const headers: SecurityHeader[] = [
|
||||
{ key: 'Content-Security-Policy', value: "default-src 'none'; img-src 'self' data:; style-src 'unsafe-inline'; sandbox" },
|
||||
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
||||
]
|
||||
return collections.map((slug) => ({ headers, source: `/api/${slug}/file/:path*` }))
|
||||
return collections.map((slug) => ({ headers: [...UPLOAD_SECURITY_HEADERS], source: `/api/${slug}/file/:path*` }))
|
||||
}
|
||||
|
||||
/**
|
||||
* The headers themselves: for any response that carries the bytes of an uploaded file from the
|
||||
* site's own origin (the upload routes above; the plugin's `/api/ipal/admin-icon`; a route of yours).
|
||||
*/
|
||||
export const UPLOAD_SECURITY_HEADERS: readonly SecurityHeader[] = [
|
||||
{ key: 'Content-Security-Policy', value: "default-src 'none'; img-src 'self' data:; style-src 'unsafe-inline'; sandbox" },
|
||||
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user