diff --git a/docs/agent/reference-site/INDEX.md b/docs/agent/reference-site/INDEX.md index 17cdb50..7e999b8 100644 --- a/docs/agent/reference-site/INDEX.md +++ b/docs/agent/reference-site/INDEX.md @@ -2,7 +2,7 @@ -The reference site is one complete client site on ipal-kit 1.16.5 ("Example Studio", made up) that uses +The reference site is one complete client site on ipal-kit 1.16.6 ("Example Studio", made up) that uses every convention in AGENT.md. It lives in the plugin repo (`reference/`, not in the npm package). Copy the PATTERN of the file you need; change only the project's content. Files up to 40 lines are below in full; open the rest in the repo at the tag of your plugin version: diff --git a/docs/agent/skills/ipal-upgrade/SKILL.md b/docs/agent/skills/ipal-upgrade/SKILL.md index c9bd3c5..ed623c8 100644 --- a/docs/agent/skills/ipal-upgrade/SKILL.md +++ b/docs/agent/skills/ipal-upgrade/SKILL.md @@ -380,16 +380,19 @@ gets `403` from the same addresses and from `POST /api/setup-totp`. The Coolify strips `back`, can keep them (`twoFactor.safeBack: false` turns the plugin's check off). 2. `pnpm ipal:skills`. -**→ the release with `twoFactor.requireSetup` — 2FA setup required (CHANGELOG "Unreleased — 2FA setup required"; PROGRAMISTA §6, item 68; security.md "Setup required") — required -with 2FA on:** +**→ 1.16.6 — 2FA setup required (CHANGELOG 1.16.6; PROGRAMISTA §6, item 68; security.md "Setup required") — required with 2FA on:** +**Not a routine patch, although the number is one.** From this version an account without 2FA can only set it up and is +blocked after 72 hours; on Postgres / SQLite a missing migration locks everyone out of the panel. Do not upgrade a live +site without steps 1–3 and a deploy day agreed with the owner. Steps 2, 3 and 5 go in ONE deploy. 1. **Before upgrading a live site:** `pnpm exec ipal-doctor --url ` (doctor token) → accounts without 2FA. Tell the owner: from the upgrade on, such an account can only set 2FA up, and has 72 hours for it; after that an administrator must reopen setup on the account's page. Have them set it up now, or remove unused accounts. - Make sure at least one administrator has 2FA set up — otherwise nobody can reopen setup from the panel. + Make sure at least one administrator (better two) has 2FA set up — otherwise nobody can reopen setup from the panel. The 72 hours of existing accounts start at the first start after the deploy and are counted once (restarts and redeploys do not extend them): agree the deploy day with the owner. 2. Update the package, `pnpm install`, `pnpm ipal:skills`, `pnpm payload generate:types`, - **`pnpm payload generate:importmap`** (new: `TwoFactorStatusField`, `TwoFactorAlert`; commit `importMap.js`). + **`pnpm payload generate:importmap`** (new: `TwoFactorStatusField`, `TwoFactorAlert`; commit `importMap.js`), + then `pnpm exec ipal-doctor` before deploying. 3. **Postgres/SQLite — required, same deploy, or nobody can log in:** `pnpm payload migrate:create` (adds the column `totp_setup_from` to the 2FA collection; needed whenever 2FA is on, also with `requireSetup: false`), commit, and have it applied **when the new container starts**: `prodMigrations` in the database adapter, or the @@ -406,8 +409,11 @@ with 2FA on:** Postgres/SQLite: if logins answer 500 after the deploy, the migration from step 3 did not run — check that it is committed and that the container runs migrations at start (deployment.md §4.3), then redeploy. 6. `requireSetup.exempt` must be a plain function returning `true` / `false` (an `async` one stops the start). - Scripts that used `POST /api/ipal/two-factor/reset` with an API key: refused by default now — pass - `twoFactor.resetAccess` if that is wanted. A reset ends the account's sessions (it logs in again). + A script on an API key is refused by `POST /api/ipal/two-factor/reset` by default — pass + `twoFactor.resetAccess` if that is wanted. A reset ends the account's sessions (it logs in again); after a + suspected compromise change the password too. An SVG favicon has no tab icon on the 2FA screens. +7. Tell the owner what to tell the staff: a new account has 72 hours to set 2FA up, then an administrator must + choose "Reopen setup". Not wanted: `twoFactor.requireSetup: false`, or `{ windowHours: false }`. **Every administrator is blocked** (all missed the 72 h): security.md "Every administrator is blocked" — a `pnpm payload run` script that sets `totpSetupFrom` to now for one administrator, or `requireSetup: { windowHours: false }` + redeploy, set 2FA up, put it back. diff --git a/docs/dev/PROGRAMISTA.md b/docs/dev/PROGRAMISTA.md index 4bdd59b..00b4533 100644 --- a/docs/dev/PROGRAMISTA.md +++ b/docs/dev/PROGRAMISTA.md @@ -675,7 +675,7 @@ Do one item at a time, build, check. Order by importance: | 65 | **1.16.4 — security** — with 2FA on, a login with the password only gets `200` from `/api/globals/site-integrations` or `/api/form-submissions`; or the project has a second auth collection (`customers`) | Upgrade and redeploy (no config change with one auth collection). With the owner: change the SMTP password and the Turnstile secret, review Site settings / Site integrations / each form's Emails tab for values nobody set. Second auth collection: `admin: { user }` in `buildConfig`, `adminOrSelfIn('')`, `access.staffCollections` only for a second STAFF collection. Every account must have 2FA set up (`ipal-doctor --url` → 0 without). Own endpoints: `secondFactorPassed(req)`; own `overrideAccess: false` calls: `user` from `payload.auth()`. `pnpm ipal:skills`; no migration | CHANGELOG 1.16.4, security.md "What the second factor covers", access.md "Who is staff" | | 66 | **1.16.4** — production `PAYLOAD_SECRET` shorter than 32 characters (the site would stop at `assertEnv`) | Before deploying 1.16.4, check the length in Coolify (`node -e 'console.log(process.env.PAYLOAD_SECRET.length)'`). Shorter: a random 32+ character secret (logs everyone out, asks for 2FA again, breaks stored API keys), or `ipalEnvRules({ secretMinLength: 0 })` for now | CHANGELOG 1.16.4, deployment.md "PAYLOAD_SECRET — length and changing it" | | 67 | **1.16.5 — security** — with 2FA on, `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` sends the user to example.com after the code (and `back=javascript:…` runs script in the panel) | Upgrade and, **in ONE deploy**, `pnpm payload generate:importmap` (adds `@intecion/ipal-kit/admin#SafeTotpView`), commit `importMap.js`, `rm -rf .next`, redeploy on Coolify — with the old map the 2FA screens have no code form and nobody can sign in (run `pnpm exec ipal-doctor` before deploying; the start log says so too); check: the link above ends on `/admin`. `pnpm ipal:skills`. No option, env or migration; off / own rule: `twoFactor.safeBack` | CHANGELOG 1.16.5, security.md "The `back` link of the 2FA screens" | -| 68 | **Unreleased — 2FA setup required** — an account that has not set 2FA up still reads data over the API with its password; or after the upgrade an account "can do nothing" / is blocked | Before upgrading: `ipal-doctor --url` → accounts without 2FA set it up or are removed; one admin must have 2FA. Then: update, `generate:types`, `generate:importmap` (`TwoFactorStatusField`, `TwoFactorAlert`), **Postgres/SQLite: `migrate:create` and the migration applied in the same deploy when the new container starts — `prodMigrations` or `pnpm payload migrate && pnpm start`, never a pre-deployment command (deployment.md §4.3) — (column `totp_setup_from`); without it every login answers 500**, build, redeploy. Existing accounts get 72 h from the first start; blocked later → admin: account page → "Reopen setup". Password-login integrations: API key or `requireSetup.exempt`. `pnpm ipal:skills` | CHANGELOG "Unreleased — 2FA setup required", security.md "Setup required" | +| 68 | **1.16.6 — 2FA setup required** (not a routine patch: a new default that can lock accounts out) — an account that has not set 2FA up still reads data over the API with its password; or after the upgrade an account "can do nothing" / is blocked | Before upgrading: `ipal-doctor --url` → accounts without 2FA set it up or are removed; one admin (better two) must have 2FA; deploy day agreed with the owner. Then, in ONE deploy: update, `generate:types`, `generate:importmap` (`TwoFactorStatusField`, `TwoFactorAlert`), **Postgres/SQLite: `migrate:create` and the migration applied in the same deploy when the new container starts — `prodMigrations` or `pnpm payload migrate && pnpm start`, never a pre-deployment command (deployment.md §4.3) — (column `totp_setup_from`); without it every login answers 500**, build, redeploy. Existing accounts get 72 h from the first start; blocked later → admin: account page → "Reopen setup". Password-login integrations: API key or `requireSetup.exempt`. `pnpm ipal:skills` | CHANGELOG 1.16.6, security.md "Setup required" | After updating the package: `pnpm ipal:skills` (new skill versions), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep for the new symbol in `node_modules/@intecion/ipal-kit/dist`. diff --git a/reference/.agents/skills/ipal-upgrade/SKILL.md b/reference/.agents/skills/ipal-upgrade/SKILL.md index c9bd3c5..ed623c8 100644 --- a/reference/.agents/skills/ipal-upgrade/SKILL.md +++ b/reference/.agents/skills/ipal-upgrade/SKILL.md @@ -380,16 +380,19 @@ gets `403` from the same addresses and from `POST /api/setup-totp`. The Coolify strips `back`, can keep them (`twoFactor.safeBack: false` turns the plugin's check off). 2. `pnpm ipal:skills`. -**→ the release with `twoFactor.requireSetup` — 2FA setup required (CHANGELOG "Unreleased — 2FA setup required"; PROGRAMISTA §6, item 68; security.md "Setup required") — required -with 2FA on:** +**→ 1.16.6 — 2FA setup required (CHANGELOG 1.16.6; PROGRAMISTA §6, item 68; security.md "Setup required") — required with 2FA on:** +**Not a routine patch, although the number is one.** From this version an account without 2FA can only set it up and is +blocked after 72 hours; on Postgres / SQLite a missing migration locks everyone out of the panel. Do not upgrade a live +site without steps 1–3 and a deploy day agreed with the owner. Steps 2, 3 and 5 go in ONE deploy. 1. **Before upgrading a live site:** `pnpm exec ipal-doctor --url ` (doctor token) → accounts without 2FA. Tell the owner: from the upgrade on, such an account can only set 2FA up, and has 72 hours for it; after that an administrator must reopen setup on the account's page. Have them set it up now, or remove unused accounts. - Make sure at least one administrator has 2FA set up — otherwise nobody can reopen setup from the panel. + Make sure at least one administrator (better two) has 2FA set up — otherwise nobody can reopen setup from the panel. The 72 hours of existing accounts start at the first start after the deploy and are counted once (restarts and redeploys do not extend them): agree the deploy day with the owner. 2. Update the package, `pnpm install`, `pnpm ipal:skills`, `pnpm payload generate:types`, - **`pnpm payload generate:importmap`** (new: `TwoFactorStatusField`, `TwoFactorAlert`; commit `importMap.js`). + **`pnpm payload generate:importmap`** (new: `TwoFactorStatusField`, `TwoFactorAlert`; commit `importMap.js`), + then `pnpm exec ipal-doctor` before deploying. 3. **Postgres/SQLite — required, same deploy, or nobody can log in:** `pnpm payload migrate:create` (adds the column `totp_setup_from` to the 2FA collection; needed whenever 2FA is on, also with `requireSetup: false`), commit, and have it applied **when the new container starts**: `prodMigrations` in the database adapter, or the @@ -406,8 +409,11 @@ with 2FA on:** Postgres/SQLite: if logins answer 500 after the deploy, the migration from step 3 did not run — check that it is committed and that the container runs migrations at start (deployment.md §4.3), then redeploy. 6. `requireSetup.exempt` must be a plain function returning `true` / `false` (an `async` one stops the start). - Scripts that used `POST /api/ipal/two-factor/reset` with an API key: refused by default now — pass - `twoFactor.resetAccess` if that is wanted. A reset ends the account's sessions (it logs in again). + A script on an API key is refused by `POST /api/ipal/two-factor/reset` by default — pass + `twoFactor.resetAccess` if that is wanted. A reset ends the account's sessions (it logs in again); after a + suspected compromise change the password too. An SVG favicon has no tab icon on the 2FA screens. +7. Tell the owner what to tell the staff: a new account has 72 hours to set 2FA up, then an administrator must + choose "Reopen setup". Not wanted: `twoFactor.requireSetup: false`, or `{ windowHours: false }`. **Every administrator is blocked** (all missed the 72 h): security.md "Every administrator is blocked" — a `pnpm payload run` script that sets `totpSetupFrom` to now for one administrator, or `requireSetup: { windowHours: false }` + redeploy, set 2FA up, put it back. diff --git a/reference/AGENTS.md b/reference/AGENTS.md index 524615c..ad84691 100644 --- a/reference/AGENTS.md +++ b/reference/AGENTS.md @@ -47,7 +47,7 @@ Write everything in this file in English. -## ipal-kit 1.16.5 — agent guide +## ipal-kit 1.16.6 — agent guide This project is built on `@intecion/ipal-kit` (a Payload CMS 3 plugin). Before you write code: