Putting secrets in NEXT_PUBLIC_ variables
NEXT_PUBLIC_ values are meant for the browser. If a private API key or service credential uses that prefix, assume users can see it.
Fix: Move private values server-side, rotate anything exposed, and redeploy with scoped production variables.
Relying only on middleware for access control
Middleware can help route users, but sensitive reads and writes still need authorization where the request is handled.
Fix: Repeat permission checks in route handlers, Server Actions, backend policies, and admin operations.
Protecting navigation but not the underlying route
Hiding a link or button does not stop direct requests to an API route, route handler, or Server Action.
Fix: Test sensitive URLs directly as anonymous, ordinary, and admin users.
Exposing preview deployments
Preview links can reveal unfinished features, staging data, debug output, or production-connected behavior.
Fix: Protect previews or make them safe to be public before sharing them widely.
Shipping verbose errors or public source maps by accident
Detailed errors and source maps can reveal implementation details that make other mistakes easier to exploit.
Fix: Use conservative public errors and keep detailed diagnostics in private monitoring tools.
Assuming Server Actions are automatically authorized
Server Actions run on the server, but they still need to verify who is calling them and what that user may change.
Fix: Add explicit session, ownership, role, and input checks to sensitive Server Actions.
Leaving unused or debug API routes public
Temporary endpoints often survive because the happy-path UI no longer links to them.
Fix: Inventory public routes before launch and remove or protect anything that should not receive public traffic.
Treating a successful production build as proof of launch readiness
A build can pass while auth callbacks, public exposure, route permissions, monitoring, and rollback plans are still incomplete.
Fix: Use the production URL as the launch gate, not only the build output.