Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-24 20:38:42 +01:00
co-authored by Claude Opus 5.5
parent b3a5ea1323
commit 0356a329ca
2 changed files with 60 additions and 27 deletions
+59 -26
View File
@@ -8,7 +8,48 @@ versions at once, go through every "Requires project changes" section in order,
version you have. A new release = a new section at the top; we remove the oldest ones only version you have. A new release = a new section at the top; we remove the oldest ones only
once there are more than 20. once there are more than 20.
## Unreleased — 2FA setup required (version to be set at release) ## 1.16.6
> **Read before upgrading — this is not a routine patch.** It turns on a new default for every site with 2FA: an
> account that has not set 2FA up can do nothing but set it up, and is **blocked after 72 hours** until an
> administrator reopens it. On Postgres / SQLite it also needs a **migration in the same deploy, or nobody can log
> in**. Work through the list below, and agree the deploy day with the owner.
### Requires project changes (what projects must update)
**Every site with 2FA on. Do all of it in ONE deploy.**
- **Before upgrading a live site:** `pnpm exec ipal-doctor --url <site>` → accounts without 2FA. Each sets 2FA up
now, or is removed. At least one administrator (better two) must have 2FA set up, or nobody can reopen setup
from the panel.
- **Agree the day with the owner:** the 72 hours of every existing account without 2FA start at the deploy,
once. Deploy when those people can act within three days (not before a holiday), or have them set 2FA up first.
- **In the same deploy:** the update, `pnpm payload generate:types`, `pnpm payload generate:importmap` (commit
`importMap.js`; new: `TwoFactorStatusField`, `TwoFactorAlert`), `rm -rf .next`, redeploy. Run
`pnpm exec ipal-doctor` before deploying: it reports a map without the new entries (then the panel has no "Reopen
setup"). Coming from before 1.16.5, the map must also have `SafeTotpView`, or the 2FA screens have no code form.
- **Postgres / SQLite — required, in the same deploy: `pnpm payload migrate:create`, commit, and the migration
applied when the new container starts** (`prodMigrations`, or `pnpm payload migrate && pnpm start` —
[deployment.md §4.3](./deployment.md#43-database-migrations-postgres); not Coolify's Pre-deployment command,
which runs in the old container). The 2FA collection gets the column `totp_setup_from`.
**Without it every login answers 500 — administrators with 2FA included — and nobody can sign in to the
panel.** The log says so at start (`NOBODY CAN LOG IN`), and `ipal-doctor` reports a SQL project whose
migrations do not mention the column. Every project with 2FA on needs it, also with `requireSetup: false`.
MongoDB: nothing.
- **An integration that logs in with a password and has no TOTP** stops working: give it an API key (passes as
before) or exempt it on purpose: `twoFactor.requireSetup: { exempt: ({ user }) => user.email === '…' }`.
- **Own code** calling `payload.find({ …, user, overrideAccess: false })` with a user fetched by id: refused for
every account of the 2FA collection now (before: only accounts with TOTP set up). Use `payload.auth({ headers })`.
- **A reset by an administrator logs that account out everywhere** and needs the administrator's own TOTP code. A
script on an API key needs `twoFactor.resetAccess`. After a suspected compromise change the password too.
- **Options:** `windowHours` is a number (0 or more) or `false`; `exempt` is a plain function returning exactly
`true`, never `async`. A wrong value stops the build and the start with a clear error.
- **After deploy:** read the log line `[ipal] 2FA: N existing account(s) without two-step verification…` and tell
the owner; after 72 hours such an account needs "Reopen setup" from an administrator. Tell the staff: a new account has
72 hours to set 2FA up. `pnpm ipal:skills`.
- **An SVG favicon** has no tab icon on the 2FA screens (use a PNG if that matters).
- **Every administrator is blocked:** security.md "Every administrator is blocked" (a script, or
`{ windowHours: false }` and a redeploy).
- **Not wanted on a site:** `twoFactor.requireSetup: false` (the previous behaviour), or
`{ windowHours: false }` to keep the lock without the time limit. Sites with `twoFactor: false` are not affected.
### Changed ### Changed
- **An account without two-step verification can only set it up** (`twoFactor.requireSetup`, on by default with - **An account without two-step verification can only set it up** (`twoFactor.requireSetup`, on by default with
@@ -42,7 +83,7 @@ once there are more than 20.
`twoFactorSetupDeadline`, `buildSetupFields`, `stampSetupFrom`, `backfillSetupFrom`, `twoFactorSetupDeadline`, `buildSetupFields`, `stampSetupFrom`, `backfillSetupFrom`,
`buildTwoFactorResetEndpoint`, `countAccountsWithoutTotp`, `resolveRequireSetup`, `strictExempt`, `buildTwoFactorResetEndpoint`, `countAccountsWithoutTotp`, `resolveRequireSetup`, `strictExempt`,
`SETUP_FROM_FIELD`, `TWO_FACTOR_RESET_PATH`, `DEFAULT_SETUP_WINDOW_HOURS`, `fetchPublicImage`, `SETUP_FROM_FIELD`, `TWO_FACTOR_RESET_PATH`, `DEFAULT_SETUP_WINDOW_HOURS`, `fetchPublicImage`,
`publicImageDataUri`, `siteOrigin`, `PUBLIC_IMAGE_MAX_BYTES`, `UPLOAD_SECURITY_HEADERS`; admin components `publicImageDataUri`, `rasterImageType`, `siteOrigin`, `PUBLIC_IMAGE_MAX_BYTES`, `UPLOAD_SECURITY_HEADERS`; admin components
`TwoFactorStatusField`, `TwoFactorResetButton`, `TwoFactorAlert`. `TwoFactorStatusField`, `TwoFactorResetButton`, `TwoFactorAlert`.
- `requireSetup.exempt` is strict: only an answer of exactly `true` exempts. An `async` function, and a - `requireSetup.exempt` is strict: only an answer of exactly `true` exempts. An `async` function, and a
`windowHours` that is not a number or `false`, stop the site at start with a clear error. `windowHours` that is not a number or `false`, stop the site at start with a clear error.
@@ -56,30 +97,22 @@ once there are more than 20.
- ipal-doctor: the `2fa` rule says how many accounts without 2FA are blocked (`usersSetupClosed` in the deep - ipal-doctor: the `2fa` rule says how many accounts without 2FA are blocked (`usersSetupClosed` in the deep
status), warns when `requireSetup` is switched off and notes a missing setup window. status), warns when `requireSetup` is switched off and notes a missing setup window.
### Requires project changes ### Known limitations
- **Before upgrading a live site:** `pnpm exec ipal-doctor --url <site>` → accounts without 2FA. Each sets 2FA up - **Inside the window** someone who knows the password of an account without 2FA can still set it up with their own
now, or is removed. At least one administrator must have 2FA set up, or nobody can reopen setup from the panel. authenticator; the owner is then refused ("already set") and has to ask an administrator. Set 2FA up at once.
- `pnpm payload generate:importmap` (commit `importMap.js`) and `pnpm payload generate:types`, in the same - A session without 2FA keeps what Payload gives any session about itself: `/api/access`, token refresh, logout, its own
deploy as the upgrade (as for 1.16.5: a stale import map leaves the 2FA screens without a code form). `ipal-doctor` panel preferences.
reports a map without `TwoFactorStatusField` / `TwoFactorAlert` (then the panel has no "Reopen setup"). - **An exempt account** works on its password alone, with everything its role allows: give it the lowest role.
- **Plan the upgrade with the owner:** the 72 hours of every existing account without 2FA start at the deploy, - A second staff collection (`access.staffCollections`) is outside 2FA and outside this mode, as before. With
once. Deploy when those people can act within three days (not before a holiday), or have them set 2FA up first. `twoFactor.guard: false` the mode is off and the reset endpoint does not exist.
- **Postgres / SQLite — required, in the same deploy: `pnpm payload migrate:create`, commit, and the migration - With `auth.useSessions: false` a reset has no sessions to end: tokens live until they expire. The 2FA package's own
applied when the new container starts** (`prodMigrations`, or `pnpm payload migrate && pnpm start` — remove / reset endpoints do not end sessions.
[deployment.md §4.3](./deployment.md#43-database-migrations-postgres); not Coolify's Pre-deployment command, - The `ipal-doctor` migration check is a text search in `src/migrations` and `migrations`.
which runs in the old container). The 2FA collection gets the column `totp_setup_from`. - A site that does not use `buildUploadSecurityHeaders()` still serves a scripted SVG from its media URL as before.
**Without it every login answers 500 — administrators with 2FA included — and nobody can sign in to the - **Not run for this release:** a generated migration, `prodMigrations` and a real Coolify deploy (the missing and the
panel.** The log says so at start (`NOBODY CAN LOG IN`), and `ipal-doctor` reports a SQL project whose added column were tested on Postgres 17 and SQLite); an upgrade of a real site; two containers; media on R2 / S3;
migrations do not mention the column. Every project with 2FA on needs it, also with `requireSetup: false`. `useSessions: false`; the reset by an API-key admin over HTTP; payload-2fa beta.1 and the Polish notices in a
MongoDB: nothing. browser; Firefox / WebKit; a Docker image; a Next `basePath`; Payload below 3.94.1.
- **An integration that logs in with a password and has no TOTP** stops working: give it an API key (passes as
before) or exempt it on purpose: `twoFactor.requireSetup: { exempt: ({ user }) => user.email === '…' }`.
- **Own code** calling `payload.find({ …, user, overrideAccess: false })` with a user fetched by id: refused for
every account of the 2FA collection now (before: only accounts with TOTP set up). Use `payload.auth({ headers })`.
- **After deploy:** read the log line `[ipal] 2FA: N existing account(s) without two-step verification…` and tell
the owner; after 72 hours such an account needs "Reopen setup" from an administrator.
- **Not wanted on a site:** `twoFactor.requireSetup: false` (the previous behaviour), or
`{ windowHours: false }` to keep the lock without the time limit. Sites with `twoFactor: false` are not affected.
## 1.16.5 ## 1.16.5
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@intecion/ipal-kit", "name": "@intecion/ipal-kit",
"version": "1.16.5", "version": "1.16.6",
"description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.", "description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
"license": "MIT", "license": "MIT",
"repository": { "repository": {