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
+17
View File
@@ -45,6 +45,18 @@ beforeAll(async () => {
{ slug: 'media', fields: [], upload: { staticDir: path.join(os.tmpdir(), 'ipal-test-media') } },
],
db: testDatabase('query_guard'),
// the server's own read on behalf of a request without an account (the cookie scanner's scheduled crawl does this)
endpoints: [
{
handler: async (req) => {
const all = await req.payload.find({ collection: 'notes' as never, depth: 0, limit: 0, overrideAccess: true, pagination: false, req })
const asCaller = await req.payload.find({ collection: 'notes' as never, depth: 0, limit: 0, overrideAccess: false, pagination: false, req })
return Response.json({ all: all.docs.length, asCaller: asCaller.docs.length })
},
method: 'get',
path: '/own-read',
},
],
editor: lexicalEditor(),
plugins: [iapl({ access: { authCollection: 'users' }, i18n: { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'Polski' }] }, twoFactor: false })],
secret: 'integration-test-secret-0123456789',
@@ -81,6 +93,11 @@ describe('F4: public lists are capped for callers that are not staff', () => {
expect((await payload.find({ collection: 'notes' as never, limit: 1000 })).docs).toHaveLength(130)
})
test('a read that bypasses access, inside a request without an account, is the server\'s own: not capped', async () => {
const res = await fetch(`${base}/api/own-read`, { headers: { origin: base } })
expect(await res.json()).toEqual({ all: 130, asCaller: 100 })
})
test('GraphQL lists from outside are capped as well', async () => {
const res = await fetch(`${base}/api/graphql`, { body: JSON.stringify({ query: '{ Notes(limit: 100000) { docs { id } } }' }), headers: { 'content-type': 'application/json', origin: base }, method: 'POST' })
const body = (await res.json()) as { data?: { Notes?: { docs: unknown[] } } }