Skip to content

commandSecurity

Check Auth

Walks every route and handler in an area and confirms each one checks who the caller is and what they may do.

npx workspacetemplates add check-auth --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/check-auth.md14 lines · 1.2 KBFile
---
description: Walks every route and handler in an area and confirms each one checks who the caller is and what they may do.
argument-hint: "[route folder, controller or area name]"
---

Check authentication and authorization for: $ARGUMENTS (all routes if empty).

1. Find the route table or controllers for that area and list every handler with its method and path.
2. For each, record: how the caller is authenticated (middleware, decorator, guard, session check, none), and what authorization is applied (role check, permission, ownership check, none).
3. For handlers that load a record by id, read the query and confirm it is scoped to the caller or tenant. Flag any lookup that uses only the id from the request.
4. Look at the defaults: does a new route get protection automatically, or must someone remember to add it? Flag public routes that were clearly meant to be private (admin, export, internal, debug).
5. Check that checks happen on the server and not only in the UI, and that failures return 401 or 403 rather than empty data.

Do not edit code. Report a matrix of route, auth, authz, ownership check, and verdict (ok, weak, missing), with the worst gaps first and a one-line fix each. Ask which gaps to patch.

What it does

Most access-control bugs are a single missing check on one forgotten route. This command lists every handler in the area you name and, for each, shows where authentication happens and where authorization is decided.

It pays special attention to object ownership, since fetching a record by id without checking the owner is the classic leak. The output is a matrix you can review in minutes.

Example

you › /check-auth src/routes/invoices

agent › 6 handlers checked.
ok: GET /invoices (auth + tenant scope)
missing: GET /invoices/:id loads by id only, any logged-in user can read any invoice.
weak: DELETE /invoices/:id checks login but not the admin role.
Patch the two gaps?

Questions

Does it test the running app?
No. It reads the code. For live verification, pair its matrix with an integration test.
Which frameworks does it work with?
Any. It looks for middleware, guards and decorators in whatever form your framework uses.
  • Audit Dependencies

    CommandSecurity

    Free
  • Find Secrets

    CommandSecurity

    Free
  • Harden Input

    CommandSecurity

    Free
  • Review Permissions

    CommandSecurity

    Free