Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 1 min read

Admin routes anyone can open: how AI-built apps hide pages instead of protecting them (proofforge.live)

Admin pages are often built early and protected late. In AI-generated apps the /admin route may hide its links from normal users while the page and the API behind it stay open to anyone who types the URL. The t

Admin pages are often built early and protected late. In AI-generated apps the /admin route may hide its links from normal users while the page and the API behind it stay open to anyone who types the URL.

The three ways it goes wrong

  • Hidden, not protected. The nav bar only shows Admin to admins, but /admin itself loads for everyone.
  • Frontend-only checks. The page checks user.role === 'admin' in the browser, while the API routes it calls (/api/admin/users) check nothing.
  • Default or guessable routes. /admin, /dashboard, /api/admin, /debug, /api/health, /_next/data and /phpmyadmin left reachable.

How to check your own app

  1. Log out completely (or use a private window) and open /admin, /dashboard, /api/admin/users and /debug. You should see a login page, 401 or 403, not data.
  2. Log in as a normal user and try the same URLs. A normal user should get 403.
  3. In DevTools Network, note the API calls an admin page makes, then replay them logged out with curl. If they return data, the API is open no matter what the page does.

Only test apps you own.

Fix

  1. Enforce authorization on the server, in every admin API route and in middleware, not just in the UI.
  2. Check the role from the verified session or token, never from a field the client sends.
  3. Remove debug and test routes before deploy.
  4. Add an automated test that calls each admin route logged out and as a normal user and expects 401 or 403.

Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.