medium10 pts · first answer countsnextjsauthorizationserver-actions
Hiding the button is not auth
A Next.js Server Action deleteProject(id) is only rendered on the admin page, so it has no permission check inside. Why is this unsafe?
'use server'
export async function deleteProject(id: string) {
await db.project.delete({ where: { id } })
}Discussion 0
Join free to post in the discussion.
Related questions
- Where to keep a secret keyFull Stack Developer
- Status 401 vs 403Full Stack Developer
- useState in an App Router pageFull Stack Developer
- Renaming a secret to NEXT_PUBLIC_Full Stack Developer
- Server Components and the databaseFull Stack Developer
- Old title after savingFull Stack Developer
- Serving private invoice PDFsFull Stack Developer
- Changed env var, old value in browserFull Stack Developer