
- Authorization implementation across all routes and endpoints.
- Broken Object Level Authorization (BOLA / IDOR).
- Broken Function Level Authorization.
- Missing authorization checks on sensitive endpoints (admin, bulk, debug).
- Role-based access control (RBAC) correctness and deny-by-default enforcement.
- Privilege escalation paths via update flows or misapplied defaults.
- JWT validation on protected routes and token revocation checks.
- Proper scope checking for API/service tokens and multi-tenant isolation.
- Field-level authorization, bulk protections, and consistent error handling.
| Check | What to verify | Notes / Example |
|---|---|---|
| Object-level authorization (BOLA/IDOR) | Enforce ownership/tenant checks on GET/PUT/DELETE /:id and any identifier-based access. | Validate IDs from URL/body/query against the authenticated user’s tenantId/userId. |
| Function-level authorization | Ensure server-side role/permission checks for all privileged routes. | Don’t rely on client-side UI checks. |
| Sensitive endpoints protected | Audit for unprotected admin/debug/bulk export routes. | Confirm middleware order: authN -> authZ -> handler. |
| RBAC mapping & deny-by-default | Map roles to explicit permissions; prevent clients from setting roles. | Store role assignments server-side only. |
| Privilege escalation vectors | Block updates to fields like role, tenantId, isAdmin unless performed by authorized system flows. | Add field-level checks in update handlers. |
| JWT verification | Use jwt.verify with algorithms, issuer, audience, and exp. Avoid trusting jwt.decode. | Check jti/tokenVersion against a revocation list. |
| API token scope checks | Enforce least-privilege scopes per token; separate user vs service tokens. | Validate audience and intended usage. |
| Multi-tenant isolation | Filter list/search endpoints by tenant, enforce server-side tenant constraints. | Avoid client-provided tenant identifiers. |
| Bulk protections | Verify ownership per item on bulk operations and limit sizes/rates. | Fail-safe per-item checks. |
| Field-level authorization | Hide sensitive fields (SSN, apiKey, secrets) from non-privileged roles. | Use projection/serialization rules. |
| Error handling/resource enumeration | Return consistent 403 vs 404 to avoid leaking existence. | Consider 404 when revealing existence is risky. |
| Middleware ordering | Ensure no handlers run before auth middleware; check nested routers. | Use top-level auth middleware where appropriate. |
| CORS & CSRF | Avoid wildcard origins with credentials; if cookies used, enforce SameSite/CSRF tokens. | Harden cross-site risks. |
| Open redirect protections | Validate redirect/next parameters against an allowlist. | Prevent phishing by open redirects. |
| Fallback/debug routes | Remove or protect /seed, /reset, /debug in prod. | Make admin-only or gated behind feature flags. |
- Risk Score: 9.5/10 (Critical)
- Critical issues identified:
- No authentication/authorization middleware — endpoints are unprotected beyond login.
- Weak JWT implementation — missing strict verification parameters; possible default secrets.
- No RBAC or object-level authorization — vulnerable to BOLA/IDOR.
- Inconsistent error handling — may leak resource existence.
This assessment indicates the application should not handle real user data in its current state. Immediate remediation is required before any production deployment.
- Authentication middleware (verify JWT)
- Issuing JWTs with recommended claims (login handler)
- Object-level ownership authorization (authorizeOwnership middleware)
- Applying middleware and enforcing authN -> authZ -> handler order
- Replace any default JWT secret (e.g., JWT_SECRET=your_jwt_secret_key_here) with a strong secret (256-bit recommended) stored in a secure secret manager.
- Implement and apply authentication middleware (jwt.verify with algorithms/issuer/audience) across all protected routes before any business logic.
- Add object-level ownership checks for all /:id and object-access routes; enforce deny-by-default for RBAC decisions.
- Audit and remove or strictly protect debug/admin routes (e.g.,
/seed,/reset,/debug) in production. - Normalize error handling to avoid resource enumeration (use 404 for not-found and 403 for explicit access-denied where appropriate).
- Title, Severity, CWE (if applicable)
- Evidence (file/function/lines)
- Why it matters
- Exploitability notes
- Minimal PoC (safe)
- Code-level remediation snippets
- Defense-in-depth guidance and recommended tests
- LLMs synthesize examples from many sources and may suggest working but insecure defaults (weak secrets, missing validations). Treat generated code as a starting point: run automated security tests and manual code review to harden before production.
- Input validation and sanitization for user- or bot-controlled inputs (prevent SQLi, injection).
- Rate limiting and brute-force protections for sensitive routes.
- Token revocation and refresh token patterns (rotate and revoke via tokenVersion/jti).
- Logging, monitoring, and alerting for suspicious authorization failures.
- Prompts and automation: https://github.com/JeremyMorgan/Claude-Code-Reviewing-Prompts
- JSON Web Tokens: https://jwt.io/
- OWASP Broken Access Control: https://owasp.org/www-project-top-ten/2017/A5_2017-Broken_Access_Control