List cap (F4): a server read with overrideAccess: true that passes a request on is not capped (the cookie scanner's scheduled crawl read its review list through the token request); reference types without the e2e fixtures; changelog heading covers all of 1.18.0

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 17:22:10 +01:00
co-authored by Claude Opus 5.5
parent e23edb2429
commit 2af8ef180f
9 changed files with 48 additions and 1297 deletions
+5 -1
View File
@@ -10,7 +10,8 @@ import { secondFactorPassed } from './totp/secondFactor.js'
* Payload's document locks closed to visitor accounts (the "document locks" door). Each is on by default, each can be
* turned off or adapted, and every piece is exported for a project's own use (docs/security.md "Lists and sorting").
*
* Local API calls (`req.payloadAPI === 'local'`: the frontend, seeds, the project's own code) are never touched.
* Local API calls (`req.payloadAPI === 'local'`: the frontend, seeds, the project's own code) are never touched, nor
* is a read with `overrideAccess: true` that server code makes while passing an outside request on.
*/
export type ListLimitOptions = {
@@ -92,6 +93,9 @@ export function buildQueryGuardHook(options: {
throw new RefusedSortError()
}
if (!limit || list.id != null || limit.exclude?.includes(collection.slug)) {return args}
// A read that bypasses access is the server's own (the plugin's or the project's code passing the request on, e.g.
// the cookie scanner's scheduled crawl, which has no account): never capped. REST and GraphQL never set it.
if ((args as { overrideAccess?: unknown }).overrideAccess === true) {return args}
if (!limit.staff && isStaffRequest(req)) {return args}
return capListLimit(list, limit.max)
}) as CollectionBeforeOperationHook