Access callbacks allow only on a literal true (owner's decision for 1.18.0), strictAccessAnswers: false for the old reading; the new 1.18.0 security options checked strictly at start; docs, skills, changelog

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 17:07:04 +01:00
co-authored by Claude Opus 5.5
parent d90825a396
commit c6bfb621f5
25 changed files with 1450 additions and 62 deletions
+13 -8
View File
@@ -1404,14 +1404,19 @@ new site from `iapl create` use both (`src/globals/Company.ts`, `Footer.tsx`, th
## Access callbacks (`cookieScanner.access`, the doctor's `access`)
A project's callback says who may use the cookie scanner's endpoints or read the doctor's status. Today any truthy
answer lets the request in: `({ req }) => req.user` returns an account object and passes, and so does a function
that returns `'no'` or `{}`. **From the next minor version (1.19.0) only `true` allows** — like
`twoFactor.requireSetup.resetAccess` already does. Since 1.18.0 the first answer that is not a boolean is reported
once per option in the server log:
`[iapl] cookieScanner.access returned an object, not true or false. It is still read as allowed; …`.
Return a boolean: `({ req }) => Boolean(req.user)`, `({ req }) => isAdmin(req.user, req.payload)`. One function reads
every answer: `accessAllowed(option, answer)` (exported). The second factor is checked before the callback, as before.
A project's callback says who may use the cookie scanner's endpoints or read the doctor's status. **Since 1.18.0 only
a literal `true` allows** — like `twoFactor.requireSetup.resetAccess` already did. A callback that returns
`req.user` (an account object), `1`, `'yes'`, `{}` or a Promise it did not await now **refuses** the request; before
1.18.0 any truthy answer let it in. The first answer that is not a boolean is reported once per option in the server
log, with the fix:
`[iapl] cookieScanner.access returned an object, not true or false, so the request was refused (only true allows since 1.18.0). Return a boolean, e.g. ({ req }) => Boolean(req.user) …`.
Return a boolean: `({ req }) => Boolean(req.user)`, `({ req }) => isAdmin(req.user, req.payload)`; an `async`
callback is awaited, so `async ({ req }) => true` works. A project that needs the old reading back:
`iapl({ strictAccessAnswers: false })` — any truthy answer allows again (still reported once). One function reads
every answer: `accessAllowed(option, answer, { strict })`, and `strictAccessAnswers(req)` tells which reading the
request's config uses (both exported). The second factor is checked before the callback, as before. **Verify:** call
the doctor status (`GET /api/ipal/doctor` as an admin with its code) with a callback that returns `req.user`: `403` and
one `[iapl] doctor.access returned an object …` line; with `Boolean(req.user)`: `200`.
## Threat list (security audit 2026-12)
What most often hits Payload / Next.js / Node sites, ranked by how often it appeared in the advisories of the last three