React · Senior · Question 13 of 75

What's important to remember about 'use server' functions in terms of security?

Explanation

A Server Function can be called with a direct POST request, bypassing the UI. Arguments come from the client and can be forged. Inside the function, check the session and permissions, validate data (e.g. with Zod), and don't rely on the button being visible only to admins.

Further reading

Problem with a question

React · Senior · question 13

Test yourself

Take the React · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz