A Next.js interface hides the delete button from a user, but the server action still accepts their request. The permission check protected the screen, not the operation.
Server actions that read or change customer data need their own authentication and authorisation at a trusted boundary.
Treat action inputs as untrusted requests
An action may receive a record identifier, requested values, and other input. None of those values proves that the user owns the record or belongs to the named organisation.
Next.js's data-security guidance discusses server-side data boundaries and security considerations. Use the documentation for your installed version, and do not rely on the action's location in a server file as a permission policy.
Check the actor, resource, and requested operation
For a fictional project dashboard, the action should establish:
| Check | Question |
|---|---|
| Authentication | Who is making this request? |
| Membership | Which organisation context is authorised? |
| Resource access | Does this record belong within that boundary? |
| Capability | May this role perform this operation? |
| Input validity | Are the proposed values allowed? |
Keep the identity derived from the trusted session separate from any user-provided identifiers. A requested organisation ID can help locate a target, but it cannot grant access by itself.
Put reusable permission rules near the data operation
If several entry points update the same records, a shared authorised data-access function can reduce drift. It should make the required actor and operation explicit rather than silently inheriting assumptions from one page.
Check membership and role changes when the action executes. Permission established when a page first loaded may no longer be current.
Also review what the action returns. A denied request should not include a private record in an error message or validation response. Logging and support screens need appropriate boundaries too.
Test direct calls and changed identifiers
Create two fictional organisations and users with different roles. Test an allowed mutation, a cross-organisation record ID, a read-only role, a revoked membership, and a missing session.
Inspect the stored result, not just the returned error. The action must not partly update the record before the permission check fails.
For important multi-step updates, define the transaction boundary and how permission changes or concurrent edits are handled. The database-constraint article covers integrity rules that complement authorisation.
Keep interface checks for usability
Hiding or disabling unavailable controls still helps users understand their role. Keep that behaviour, but treat it as a user-experience layer backed by server enforcement.
In my StackFlight build, private founder responses are part of the product boundary. Every SaaS brief should describe comparable permission expectations rather than only login screens.
Server-action permission questions
Does being logged in mean a user can edit every record?
No. Authentication and resource-level permission are separate checks.
Is an unpredictable record ID sufficient protection?
No. Verify access even when identifiers are difficult to guess.
What should a founder request at sign-off?
Ask for allowed, denied, and cross-organisation examples with unchanged records after denial. Include them in a technical review.