Skip to content
SprecherEast
Issue 147

bug: Before resident sign-up: edit locks and the seed button

Back to our plan
Done
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

  1. 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, in src/access/accessPolicy.test.ts.
  2. 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

  1. Edit locks: check whether a newer Payload release allows overriding payload-locked-documents access. If not, block resident requests to /api/payload-locked-documents with a small route-level guard, or accept the risk explicitly.
  2. 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

See it on GitHub, opens in a new tab