Skip to content
SprecherEast
Issue 299

Add a rule: hidden Payload fields still accept writes; server-only fields need a write guard

Back to our plan
Done
cmsprocesspriority: medium

Problem

The #298 review found that a Payload field with hidden: true is hidden from reads only: Payload still accepts writes to it from the API. A server-only field on a collection anyone can create (heldEmails on form submissions) could be filled in by a visitor and then used by the server. #298 fixed that field (field access create/update/read: false, plus a hook that clears it). Nothing stops the next field from repeating the mistake.

Proposed rule (for docs/guidelines/security.md; a policy change, so it waits for the owner)

A field only the server sets must refuse writes too: access: { create: () => false, update: () => false } (and read when visitors mustn't see it), not just hidden: true. The server writes it with overrideAccess: true or the database adapter. On a collection the public can create, a beforeChange hook also overwrites it on create.

Optionally, accessPolicy.test.ts could check that every hidden field also sets field access.

Question for the owner

Add this rule (A, recommended) or not (B)?

Area

cms

Priority

Medium


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab