Skip navigation
Secure your server actions
0:00 / 0:41

Secure your server actions

Alex Sidorenko

@asidorenko_35K followers

Visit on X
712 likesDownloadOriginal post

75,146 views

Secure your server actions

10 Comments

Comments from the original post on X (Twitter)

  • Alex Sidorenko's profile picture

    @asidorenko_

    Nuance: action ID is a unique hash. If you don't render it (like in the example when the user is not an admin), it would be hard to trigger your endpoint But in any case, server actions always create endpoints, and endpoints should be protected

    32 likes

  • Eduardo Borges's profile picture

    @duborges

    damn... i probably missed that one in some project though I try to keep the actions inside a ./actions/delete-stuff.ts with 'use server' works right?

    6 likes

  • Alex Sidorenko's profile picture

    @asidorenko_

    "use server" only ensures that the code in marked file never gets into the client-side js bundle You still need to protect your server actions as if they are separate callable endpoints (because they are)

    20 likes

  • Iaci's profile picture

    @shouldbeshippin

    I (who separates front- and backend) dont understand this

    5 likes

  • Ᵽøłskɨ Ƀøɍsȼħ's profile picture

    @vodioord

    ...or next-safe-action does this trick for you 😉

    3 likes

  • yo puaaa 👋's profile picture

    @yo_puaaa

    Too many people thought server actions were a magic black box that just made things work, without realizing it's just magic POST calls!

    3 likes

  • Daniel Still's profile picture

    @still_scripts

    I love Next overall, but it's a way better experience to just use Route Handlers. Especially if you plugin a framework like Hono or Elysia for good conventions and plugins out of the box.

    3 likes

  • Legion Dev's profile picture

    @LegionWebDev

    well its same like secure your api end point lol

    2 likes

  • Ruchir's profile picture

    @heyruchir

    I wonder how many security issues modern Next has created due to server actions lol.

    2 likes

  • Aurora Scharff's profile picture

    @aurorascharff

    Also this

    2 likes