Issue 147
bug: Before resident sign-up: edit locks and the seed button
Back to our planDone
bugcmsauthpriority: medium
Type
bug
Summary
Two access loose ends found while reviewing #143. Neither can be exploited today, because only admins create accounts, but both should be settled before residents can sign up (#134).
Problem
- Edit locks.
payload-locked-documents(Admin's "someone is editing this" locks) uses Payload's default access, and Payload 3.91 offers no override for it. In the #143 re-review, a resident created a lock under the admin's user ID through the REST API. That is a nuisance, not a data leak: it can block or confuse editors in Admin. It is allowlisted, with that reason, insrc/access/accessPolicy.test.ts. - The "Seed your database" button. After #143 only admins can run
POST /next/seed. But the button still shows on the Admin dashboard for everyone with Admin access (editors get a generic error), and one click by an admin on the live site deletes most content and creates a demo admin account.
Proposed fix
- Edit locks: check whether a newer Payload release allows overriding
payload-locked-documentsaccess. If not, block resident requests to/api/payload-locked-documentswith a small route-level guard, or accept the risk explicitly. - Seed button: owner decided (2026-10-20): off on the live site, with no switch to turn it back on. In any production build the route answers 404 (even for an admin) and the button is hidden; it works only in local development. Implemented in PR #150 (open, awaiting the owner's merge).
Acceptance criteria
- Not done: A resident cannot create, change or delete edit locks, or the risk is accepted in writing on this issue.
- Not done: The seed route cannot wipe the live site by a single click, per the owner's choice above.
- Not done: Tests cover whichever guards are added.
Depends on
#143. Blocks #134 (resident sign-up).
Area
auth, cms
Priority
medium
Generated by Claude Code, opens in a new tab