IAWL ideas, group B: sizes before work, one link rule, no stand-in locale, strict switches
- Request bodies from strangers are read only up to a cap, declared length or not: mail-service confirm, CSP reports, page views, MCP (maxBytes, 413). readCappedBody moves to shared/ (the consent log keeps exporting it). - searchContent / createSearchRoute / MCP search: queryLimit (default 200 characters, 10 words) before the database; an unknown ?locale is the default locale throughout. - Rich text: autolinks and links marked internal pass safeHref too; lexicalToMarkdown drops unsafe link targets. - truncate() never returns more than its limit (summary / meta autofill after validation). - resolveRoute answers null for a locale the site does not have (xx, all, *): no default-locale page under another code (page route past the proxy, /md/xx, MCP). - A 404 page that is a draft is not shown (resolveNotFoundPage, getNotFoundPage). - readPublished() access rule (exported); Site integrations readVersions: admin. - Plugin switches, buildCsp, buildSecurityHeaders and the seed guard refuse nonsense values at start; an unknown role name is met by nobody, requireRole throws on one. - Docs, AGENT.md, iapl-collection and iapl-audit skills. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e821d52d19
commit
ecf03c8dc0
+37
-2
@@ -65,6 +65,37 @@ export default withSecurityConfig(withPayload(nextConfig))
|
||||
|
||||
With `IAPL_NOINDEX=1` (staging), `X-Robots-Tag: noindex, nofollow` is added to every response.
|
||||
|
||||
**A value the browser would not understand fails at start (1.17.1).** `hsts`, `hstsIncludeSubDomains` and
|
||||
`hstsPreload` take `true` / `false`, `hstsMaxAge` a number of seconds, `frameOptions` `'DENY'` / `'SAMEORIGIN'` /
|
||||
`null`, `coop` a COOP value or `false`, `referrerPolicy` / `permissionsPolicy` a header value or `null`. Before,
|
||||
`hsts: null` dropped HSTS and `hstsMaxAge: 'abc'` or `frameOptions: 'false'` sent a header the browser ignores.
|
||||
`buildCsp` the same way: `dev` and `strictDynamic` are booleans (`dev: 'false'` used to add `'unsafe-eval'` in
|
||||
production), `mode` is `'enforce'` / `'report-only'`, and every `extra` / `override` value is an array of sources
|
||||
(a string was spread into single characters — a lone `*` among them is a wildcard).
|
||||
|
||||
## Switches are read strictly (1.17.1)
|
||||
|
||||
A JavaScript config is not type-checked. A plugin option whose nonsense value used to switch a protection off,
|
||||
widen who sees something, or switch an opt-in feature (a public endpoint) on, now stops the start with a message
|
||||
naming the option — like `twoFactor.requireSetup.windowHours` since 1.16.6. Real values work as before.
|
||||
|
||||
| Option | Refused now | What it did before |
|
||||
|---|---|---|
|
||||
| `accounts` | `0`, `''`, anything not `false` / an object | `0` or `''` dropped every account rule |
|
||||
| `cookieScanner`, `stats`, `consentLog`, `adminMeta`, `whiteLabel`, `forms.attachments`, `cookieScanner.crawl`, `mail.relay` | a string, a number, `null` | `'false'` switched an opt-in feature on (or was ignored) |
|
||||
| `indexNow`, `lightbox`, `enabled`, `twoFactor.allowCollectionMismatch` | anything but `true` / `false` | `'false'` meant on — for the mismatch: panel users without 2FA |
|
||||
| `consentLog.retentionDays` | not a number above 0 | `null`, `0` or a negative number purged every proof of consent daily |
|
||||
| `adminMeta.robots.index` / `.follow` | anything but `true` / `false` | `'false'`, `0` or `null` took the noindex off the panel |
|
||||
| `dashboardAlerts.integrations` / `.cookies` | a name outside `'admin' / 'editor' / 'all'` (`'editor' / 'all'`) | an unknown name showed the details to every staff account |
|
||||
| `mail.relay.accountMail.windowMinutes`, `mail.relay.confirmRateLimit.windowMs` | not a number above 0 | a window of 0 is a limit that never fills |
|
||||
| `mail.relay.accountMail.perAddress` / `.perVisitor`, `confirmRateLimit.max` | not a number of at least 1 | — |
|
||||
| `forms.attachments.submit.maxPerMinute`, `.timeoutMs`, `.idleTimeoutMs` | not a number of at least 0 (`0` = off, as documented) | `'off'`, `null` or `{}` turned the limit off |
|
||||
| `storageNames` | anything but `'ipal'` / `'iapl'` | an unknown name meant `'ipal'` |
|
||||
| seed `guard` (`createSeeder`) | `0`, `''`; `allowFull` / `allowProdUpdate` / `production` not booleans | `guard: 0` dropped the production guard; `allowFull: 'false'` allowed a full seed |
|
||||
|
||||
Role names are strict too: `requireRole`, `requireRoleField` and `readPublished` throw on a name outside
|
||||
`ROLE_HIERARCHY`, and `hasMinimumRole` / `userMeetsRole` answer `false` for one (before, every staff account met it).
|
||||
|
||||
**Uploads:** `buildUploadSecurityHeaders({ collections = ['media'] })` returns `headers()` rules for
|
||||
`/api/<collection>/file/*` (sandbox, no scripts) — an SVG from local disk cannot run a script on the site's
|
||||
domain. Wire it alongside: `[{ source: '/:path*', headers: securityHeaders }, ...buildUploadSecurityHeaders()]`.
|
||||
@@ -258,7 +289,8 @@ With a custom `adminRoute` (e.g. `/its`), use that path in `source`.
|
||||
|
||||
`createCspReportRoute({ onReport?, maxBytes = 16384 })` — a `POST` handler for `reportUri`. It accepts
|
||||
both formats (`application/csp-report` from `report-uri`, `application/reports+json` from `report-to`),
|
||||
caps the body, always answers `204`, and by default logs one `console.warn` line per violation:
|
||||
caps the body (a larger one → `413`; since 1.17.1 the stream is read only up to `maxBytes`, also when the browser
|
||||
sends no `content-length`), always answers `204`, and by default logs one `console.warn` line per violation:
|
||||
`[csp] report script-src-elem blocked=https://x.example/a.js page=https://site/pl`. Read them in the
|
||||
Coolify app's **Logs**. Plug `onReport` into `payload.logger`, Sentry or a database for more.
|
||||
|
||||
@@ -1020,7 +1052,10 @@ later option, not part of this release.
|
||||
|
||||
**Versions.** The global has no versions by default. A project that turns them on
|
||||
(`globalOverrides: { 'site-integrations': { versions: … } }`) stores the secret in every version — as in the
|
||||
document itself — and reads of versions are masked like any read. A **restore** answers with the version
|
||||
document itself — and reads of versions are masked like any read. Since 1.17.1 the versions are read by the same
|
||||
people as the global (`readVersions`: admin): Payload's own default lets every signed-in account list them, an
|
||||
editor or a plain `user` account included, with the server, user name and status texts. Your own rule:
|
||||
`globalOverrides: { 'site-integrations': { access: { readVersions: … } } }`. A **restore** answers with the version
|
||||
document, the fields under `version`, where field hooks do not run: the global's `afterRead` hook
|
||||
`maskSecretsOnRestore` masks them there too. A restore brings back the password of that version.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user