payload-locked-documents: fixed access lets a user of one tenant read, create and delete lock rows of another tenant

Open
#19,709 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@JarrodMFlesch is already working on this.

Since Nov 18, 2026.

  • #19722 by @TejasLamba2006 — open
  • #19728 by @JarrodMFlesch — open
  • #19729 by @JarrodMFlesch — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, postgresql, typescript

Research direction

Start with getLockedDocumentsCollection and the reproduction branch's REPRO.md and integration test, tests/int/locked-documents.int.spec.ts. Trace how the collection sets access for read, create, update, and delete, then compare those paths with the tenant-scoped page access checks. Done when tenant A cannot read, create, or delete tenant B's lock rows and the reproduction test passes.

Written by the indexing model from the issue text.

Description

`area: core` `plugin: multi-tenant` Bug Payload OSS
Describe the Bug

getLockedDocumentsCollection sets fixed access for read, create, update and delete, and the config can't change it. with the multi-tenant plugin, a user of tenant A can list tenant B's lock rows. they see the document id and the editor's user id. population is blocked.

they can also create or delete lock rows on tenant B's documents. this can block editing for tenant B.

can the collection take access overrides, or check read access on the locked document? seen on 3.94.0.

Link to the code that reproduces this issue

https://github.com/MRNAQA/payload-repros/tree/locked-documents-tenants

Reproduction Steps

Branch locked-documents-tenants is the blank template plus @payloadcms/plugin-multi-tenant, a tenants collection and a tenant-scoped pages collection. REPRO.md has the full output.

  1. cp .env.example .env
  2. docker compose up -d (Postgres 17)
  3. pnpm install
  4. pnpm test:int tests/int/locked-documents.int.spec.ts

The test creates tenant A with user A and tenant B with user B, a tenant B page, and the lock row that the admin writes while user B edits that page. Then, as user A (overrideAccess: false):

  • read the tenant B page: rejected (control, passes)
  • list payload-locked-documents: returns user B's row
  • create a lock row on the tenant B page: succeeds
  • delete user B's lock row: succeeds
FAIL  ... > user A does not see the tenant B lock row
AssertionError: expected [ { id: 1, document: { …(2) }, …(4) } ] to deeply equal []
+     "document": { "relationTo": "pages", "value": 1 },
+     "user": { "relationTo": "users", "value": 2 },
FAIL  ... > user A cannot lock the tenant B page
AssertionError: promise resolved "{ id: 2, document: { …(2) }, …(4) }" instead of rejecting
FAIL  ... > user A cannot delete the tenant B lock row
AssertionError: promise resolved "{ id: 1, document: { …(2) }, …(4) }" instead of rejecting
Tests  3 failed | 1 passed (4)

The REST API gives the same result as user A: GET /api/pages/1 is 404, GET /api/payload-locked-documents is 200 with the row, POST is 201 and DELETE is 200.

Which area(s) are affected?

area: core, plugin: multi-tenant

Environment Info
Binaries:
  Node: 24.22.3
  npm: 11.19.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.94.0
  next: 16.4.6
  @payloadcms/db-postgres: 3.94.0
  @payloadcms/drizzle: 3.94.0
  @payloadcms/graphql: 3.94.0
  @payloadcms/next/utilities: 3.94.0
  @payloadcms/plugin-multi-tenant: 3.94.0
  @payloadcms/richtext-lexical: 3.94.0
  @payloadcms/translations: 3.94.0
  @payloadcms/ui/shared: 3.94.0
  react: 19.2.9
  react-dom: 19.2.9
Operating System:
  Platform: darwin
  Arch: arm64
PostgreSQL: 17.12
Dominant language
TypeScript
Stars
45.8k
Forks
4.4k
Avg merge
2d 16h
Merged PRs (30d)
251

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.