Merge claude/security-b-content-state-cc308e: sizes before work, one link rule, no stand-in locale, strict switches, write-only secrets cannot be queried
AGENT.md conflict: the 2FA rows from A, the stored-secrets row from B (its check answers 400 QueryError, not 403). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+45
-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.
|
||||
|
||||
@@ -1048,7 +1080,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.
|
||||
|
||||
@@ -1056,6 +1091,14 @@ document, the fields under `version`, where field hooks do not run: the global's
|
||||
value is set"; the API returns the mask. Code of your own that read the secret over REST / GraphQL as an admin
|
||||
must read it on the server with the Local API instead.
|
||||
- **Off:** `iapl({ secrets: { writeOnly: false } })` — the value is returned to whoever may read the global.
|
||||
- **A query cannot name a secret (1.17.1).** A `where` or `sort` on a write-only field answers by the stored value
|
||||
(`where[version.smtpPassword][like]=Zq` gave a count), so an admin could read the secret back one character at a
|
||||
time. `writeOnlySecret` now gives the field a `read` rule, `secretReadAccess`, that refuses a query naming it —
|
||||
REST and GraphQL, `like` / `equals` / `exists` / `sort`, on the document and its versions (an error, no count) — while
|
||||
every read of a document still answers the mask and the panel shows and saves the field as before. Payload checks a
|
||||
query's fields without a document and asks rules that depend on one to deny then; the panel always passes the
|
||||
document. The field's own `access.read` is kept and decides for a document. Not in collection list columns or
|
||||
list filters. Server code with `overrideAccess` (the Local API) may still query it.
|
||||
- **Your own secret fields:** `writeOnlySecret({ name: 'apiToken', type: 'text', admin: { components: { Field:
|
||||
'@intecion/ipal-kit/admin#MaskedField' } } })`, or `writeOnlySecrets(fields, ['apiToken'])` for fields inside
|
||||
tabs / rows / groups; the hooks `maskSecretAfterRead` / `keepSecretBeforeValidate`, `SECRET_MASK`,
|
||||
|
||||
Reference in New Issue
Block a user