diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4348444..15e820e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,12 +9,47 @@ 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 once there are more than 20. -## 1.17.1 — DRAFT (security group C: files, jobs, outside-in tests; not released) +## 1.17.1 — security fixes from the IAWL review; the panel's sign-in look -> Draft lines from the IAWL-ideas session C (branch `claude/security-c-files-jobs-tests-cfba70`); the integration -> session merges them with A and B. No option, schema, migration or import-map change. Nothing locks anybody out. +> **Read before upgrading.** No schema change, no migration on any database. In this order: +> +> **1. A write-only secret could be read back (fixed).** On 1.17.0 an **admin** could recover the SMTP password or +> the Turnstile secret key character by character through a query that names the field +> (`/api/globals/site-integrations/versions?where[version.smtpPassword][like]=…`, REST or GraphQL), **only on a site +> whose project had turned versions on** for Site integrations (off by default), or for its own collection with a +> `writeOnlySecret` field. An editor or a plain account could not (their query on the field was refused); visitors +> never. Now no query can name a write-only field (`where` / `sort` answer `400 QueryError`); reads still show +> `********`. Nothing to do. If such a site is yours and an admin account may have been misused, change the SMTP +> password and the Turnstile key. +> +> **2. What can stop a site at start.** A config value the plugin does not understand now stops the start with the +> option's name, instead of being read as off or open — for example `accounts: 0`, `stats: 'false'`, +> `consentLog: { retentionDays: null }`, `dashboardAlerts.integrations: 'Admin'`, `buildCsp({ dev: 'false' })`, +> `buildSecurityHeaders({ hsts: null })`, seed `guard: 0`, a `developmentHosts` list that is not one. Role names +> outside `user`, `editor`, `admin` in `requireRole` / `requireRoleField` throw. Real values start as before. +> **Check before deploying:** `pnpm build` (the error names the option; security.md → "Switches are read strictly"). +> +> **3. What people see change.** +> - **Sites with `whiteLabel`: the panel's sign-in page has a new look** — a dark panel with the client's logo +> (Site settings → Logo) or the site's name beside the form, on login and the 2FA screens. **Editors can no longer +> change the site's name, logo and icon** in Site settings (admins can; `whiteLabel: { brandAccess: 'editor' }` +> gives it back). **An SVG logo is not shown on the sign-in screens** (the site's name is; `signIn: { svgLogo: true }` +> allows it). A dark logo: `signIn: { logoPlate: true }`. The old screens: `whiteLabel: { signIn: false }`. +> Forgot / reset password, first user and logout get the look with **one config line**, +> `whiteLabel: { signIn: { allScreens: true } }`, and `pnpm payload generate:importmap`. +> - **2FA:** correct codes are never refused any more (only wrong ones count towards the limit); several attempts at +> once may be told "try again in a moment". The admin's 2FA reset works only from the site's own pages. +> - **Visitors:** `/md/` is a 404; a never-published page assigned as the 404 +> page is not shown; a search longer than 10 words or 200 characters is searched by its first words. +> - **A site without `serverURL` and without `NEXT_PUBLIC_SERVER_URL`** loses the logo in its panel link preview. +> +> **4. One line in each project:** the proxy matcher (`src/proxy.ts`) — +> `'/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'`; `iapl-doctor` warns `proxy-matcher` until it is changed. Without it +> pages whose names only start with `api` / `admin` / `_next` skip the proxy, as before. ### Security +- **Write-only secrets cannot be named in a query** (point 1 above). `secretReadAccess`, the field read rule behind + it, is exported; `writeOnlySecret` sets it. - **The proxy matcher skipped pages that only start with `api`, `admin` or `_next`.** The documented literal `'/((?!api|admin|_next|.*\\..*).*)'` did not end those names at "/", so `/administracja`, `/admin-guide` or `/apis` skipped the proxy: no locale redirect, and on a single-locale site with `createProxy({ csp })` no CSP. The @@ -29,8 +64,59 @@ once there are more than 20. - **The starter bundle followed symbolic links**: a link committed under `reference/` would have shipped its target's content in the published bundle (none existed). Links are refused; `iapl create` also refuses a bundle path that leaves the new folder. +- **2FA verify limit counts wrong codes only.** Before, every attempt counted, so the sixth correct login of one + account within 10 minutes (an office sharing a login, several devices) was refused for 10 minutes. Five wrong + codes still lock the account for the window. Several attempts of one account at the same moment: one may be told + "being checked right now, try again in a moment" (`429`, `Retry-After: 2`). A project that wires + `buildVerifyLimit` into its own endpoint calls `limit.settle(req, correct)` after its check. +- **`POST /api/ipal/two-factor/reset` refuses a request a browser marks as coming from another origin** (`403`), like + verify and setup since 1.16.7: a page on a sibling subdomain could reset any account's 2FA with an admin's cookie + when `serverURL` was not set. `twoFactor.sameOrigin: false` turns it off. +- **Request bodies from strangers are read only up to their cap**, also without a `content-length`: the mail-service + confirm call, CSP reports, page views (stats) and MCP (`maxBytes`, 64 KiB). +- **Rich-text links:** one check for every stored URL (`autolink`, links marked internal, the Markdown output). +- **Strict switches** (point 2 above): `hasMinimumRole` / `userMeetsRole` answer `false` for an unknown role name; + before, every staff account met it. +- **Site integrations versions** (when a project turns them on): only admins list them (`readVersions`). +- **Unknown locales:** `resolveRoute` returns nothing for a code the site does not have (`isSiteLocale`); `/md/xx`, + MCP `get_page` and the search route no longer fall back to the default language's page. +- **The 404 page:** a never-published page assigned in System pages is not rendered. +- **The public preview-image endpoint could be made to fetch from a host named in the request.** + `GET /api/ipal/admin-og` resolved a site-relative logo address against the request's own host and fetched it with + redirects followed, no timeout and no size limit; `GET /api/ipal/admin-icon` resolved the same way. Both now + resolve against the site's configured origin only (`serverURL`, else `NEXT_PUBLIC_SERVER_URL`), ask one address, + never follow a redirect, give up after 5 s and stop reading at 512 KB. `fetchPublicImage` (exported) behaves so + for every caller and takes `{ timeoutMs }`; new export `PUBLIC_IMAGE_TIMEOUT_MS`. **For a project:** nothing to do + when `serverURL` is set (the starter sets it). A site without `serverURL` and without `NEXT_PUBLIC_SERVER_URL` + loses the logo in its panel link preview (the site name is drawn) and the icon endpoint redirects to the media + file — set `serverURL`. A logo or icon whose address answers with a redirect is no longer fetched by the server. ### Added +- **Sign-in look (`whiteLabel.signIn`, on with `whiteLabel`).** A dark panel with the label "Administration panel", + the client's logo (Site settings → Logo) or the site's name, and the panel's languages as links; + the form beside it, in both admin themes; a band above the form on a phone. Logo and name come from Site settings: + no env var, **no new field, no schema change** (MongoDB, Postgres, SQLite alike). With nothing set the panel shows + the label and the site's host — no Payload or Intecion mark. The logo on a white plate is an option; the default is no plate. +- **`signIn: { allScreens: true }`** — the same look on forgot / reset password, create first user, logout and + "unauthorized". Adds the provider `SignInLook` (one import-map entry: `pnpm payload generate:importmap`). The + project starter writes it for new sites. A production start that does not find the entry in `importMap.js` + leaves the provider out and logs what to run; the panel keeps working. +- **The logo follows IAWL's rules:** JPEG, PNG, WebP, AVIF or GIF; fetched and checked by its bytes before it is + printed (at most 512 KB; a deleted or broken file gives the name); fits 240 × 72, served from a generated size + at least twice as wide when the media collection has one; alternative text = the site's name. +- **Options:** `signIn.accent` (hex colour of the button, links and focus ring), `signIn.logoPlate` (a white plate), + `signIn.svgLogo` (allow an SVG logo), `signIn.checkLogo: false`, `signIn.languages: false`, + `whiteLabel.brandAccess` (`'admin'` with the look, `'editor'` as before; field-level access, no schema change). + CSS variables `--iapl-signin-*` for a project's `custom.scss`. +- **Language links before sign-in:** `GET /api/ipal/admin-language?lng=` writes Payload's language cookie for + a supported language and returns to the admin page it was opened from (public; 400 for an unknown language; + never redirects off the admin route). Registered only with the sign-in look and `languages !== false`. +- **The 2FA code boxes have names** for screen readers ("Digit 2 of 6") and ask a phone for the numeric keyboard + (with the sign-in look). +- Exports: `SignInPanel`, `SignInLook` (`/admin`); `resolveSignInLook`, `loadSignInBrand`, `signInLogo`, + `signInName`, `checkLogoFile`, `fitLogo`, `isSvgUpload`, `SIGN_IN_LOGO_TYPES`, `languageLinks`, `LANGUAGE_NAMES`, `signInCss`, `isHexColour`, + `signInProviderActive`, `buildAdminLanguageEndpoint`, `adminPathFromReferer`, `SIGN_IN_LOOK`, `SIGN_IN_STYLE_ID`, + `SIGN_IN_LOGO_BOX`, `SIGN_IN_NAME_MAX`, `ADMIN_LANGUAGE_PATH` and their types. - **`routes:check`** — every public route (REST, GraphQL, Next route files) against a committed snapshot with one reason per entry; fails on a route nobody has judged. `listPublicRoutes`, `listNextRouteFiles`, `compareRouteSnapshot`, `updateRouteSnapshot` (`@intecion/ipal-kit`), `runRouteCheck` (`@intecion/ipal-kit/doctor`); @@ -39,11 +125,29 @@ once there are more than 20. visitor, a customer and an editor on a production build (security.md "Closed doors from outside"); in this repository part of `pnpm e2e:built`, in both bundlers. - `iapl-doctor` rule **`proxy-matcher`** (above). +- `readPublished(minimum)` — read rule for a collection with drafts: visitors get published documents only (by id, + list, `?draft=true`, GraphQL). `isSiteLocale`, `limitQuery`, `SEARCH_QUERY_LIMIT`, + `searchContent` / `createSearchRoute({ queryLimit })`, `createMcpRoute({ maxBytes })`, `assertPluginSwitches`. +- Docs: decide `twoFactor.requireSetup.exempt` from a field only admins can write (an admin-only checkbox), not from + the e-mail — every account may change its own e-mail (security.md). ### Changed +- `AdminLogo` prints the sign-in panel when the plugin gives it `signIn` (the default with `whiteLabel`); wired by + hand without that prop it is the plain logo as before. The logo on the login screen is now shown inside + 240 × 72 px (it was up to 420 × 120). +- The credit line under the login form: full-strength muted colour and a hairline above it (it was 60 % opacity). +- The reference site and the starter use `whiteLabel: { signIn: { allScreens: true } }`. - The plugin's own `package.json` declares `@swc/core` in `pnpm.ignoredBuiltDependencies`: its install script only checks the native binary, which the build already has. pnpm no longer asks about it (repository only; no effect on projects). +- `truncate` (summaries, meta descriptions) never returns more than its limit. + +### Requires project changes +- **The proxy matcher**, one line (point 4 above). +- **A config value the plugin does not understand** stops the start (point 2): `pnpm build` before deploying. +- **Recommended with `whiteLabel`:** `signIn: { allScreens: true }` + `pnpm payload generate:importmap`; look at a + project's own login CSS after the update. +- `serverURL` (or `NEXT_PUBLIC_SERVER_URL`) set, as the starter does, for the panel's link-preview logo. ## 1.17.0 — the plugin is called IAPL; mail works with no setup diff --git a/package.json b/package.json index a263bb0..4277735 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@intecion/ipal-kit", - "version": "1.17.0", + "version": "1.17.1", "description": "Intecion Advanced Payload Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.", "license": "MIT", "repository": { diff --git a/src/version.ts b/src/version.ts index 0bebc60..ed93cdb 100644 --- a/src/version.ts +++ b/src/version.ts @@ -7,4 +7,4 @@ * `/_next/static/media/`. Written by `node scripts/write-version.mjs` (the `version` script of * package.json runs it on `pnpm version …`); test/version.test.ts fails when the two differ. */ -export const PLUGIN_VERSION = '1.17.0' +export const PLUGIN_VERSION = '1.17.1'