Server Action security

Treating every Server Action as a public HTTP endpoint that anyone can call with any arguments.

An unchecked action lets any visitor change or read data that belongs to someone else.

In more detail

Hiding a button does not protect an action: its ID can be found and called directly. Inside every action, check the session (authentication), check that the user may touch this record (authorization) and validate every argument, for example with Zod. Return safe error messages, never raw exceptions.

Related terms

Taught in

References