Merge claude/security-c-1172: form submissions over REST only for staff, the job queue for an admin or Bearer CRON_SECRET, doctor visitor-writes

Conflicts with security-a-1172 kept both sides: imports (adminSameOrigin, jobsAccess), the doctor status (originKnown and visitorWrites), its test, and the e2e:built line (A's sign-in answers spec with C's CRON_SECRET).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 11:17:51 +01:00
co-authored by Claude Opus 5.5
40 changed files with 657 additions and 187 deletions
+8 -2
View File
@@ -636,12 +636,18 @@ for visitors. Then, all four:
`access.staffCollections` is for a second collection of STAFF (access.md → "Who is staff").
3. In every auth collection use `adminOrSelfIn('<its slug>')`, not `adminOrSelf`, for "only my own record".
4. Payload's default for a collection or global without `access` is "any logged-in account" — a customer too.
Give every collection and global explicit `access`. 2FA covers the panel's collection only.
Give every collection and global explicit `access` (writes: `adminOrEditor`, as the reference site's collections
and globals do since 1.17.2). Verify with `iapl-doctor --url …` (deep): no `visitor-writes` finding. 2FA covers
the panel's collection only.
5. Never let a sign-up write a field that grants rights (`roles`, `isAdmin`, …): give such a field
`access: { create: adminOnlyField, update: adminOnlyField }`.
6. Check: log in as such an account (`POST /api/customers/login`), then `GET /api/globals/site-integrations`,
`GET /api/form-submissions` and `GET /api/users` with its token must answer `403`, and so must
`POST /api/setup-totp`.
`POST /api/setup-totp`, `POST /api/form-submissions` and (a site with Payload jobs) `GET /api/payload-jobs/run`
(`401`).
7. Payload jobs run over HTTP: since 1.17.2 only an admin or `Authorization: Bearer <CRON_SECRET>` (when the project
writes no `jobs.access.run`). A Coolify scheduled task that calls `/api/payload-jobs/run` sends that header;
`CRON_SECRET` goes into the app's environment (security.md "Payload's job queue").
**NEVER:** a second `media`, `daneFirmy`/`settings`/
`navigation`/`footer` as collections (they are globals), FAQ/hero/features as collections