I'm using Payload for a mix of traditional content management (blogs, pages with blocks) but also as my backend for a social platform with posts, events and a few other things.
My flow is basically frontend form > server action > Zod check > then using the local api with override access disabled to create it. I'm loving the access control - it's made a lot of my granular permissions very easy to implement!
My issue however is right now I believe that users could technically hit the /api/post for example directly and bypass a lot of my Zod validation / other checks.
I thought I had solved it by endpoints: false in the collection but I guess the dashboard uses the rest api internally and that breaks it.
I don't intend to use the rest api anywhere in this app so disabling it made the most sense in my head, but I'm realizing that might be an anti-pattern for Payload? Is my best bet to just duplicate the validation in a before hook?
Would super appreciate a second opinion.. I think I've confused myself a bit
Thanks!
so I can just allow it if the user has the admin role