Skip to main content
Having completed a detailed look at authentication, this lesson focuses on authorization: verifying who can do what after identity is established. We’ll load Claude again, run an authorization review against the target application, and consolidate the findings, prioritized fixes, and ready-to-use remediation snippets.
A presentation slide titled "Authorization Implementation" with a dark curved shape on the right containing the word "Demo" in blue. A small "© Copyright KodeKloud" notice appears in the bottom-left.
Load the prompts and automation used for this assessment from the public repository: https://github.com/JeremyMorgan/Claude-Code-Reviewing-Prompts What to analyze
  • 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.
Authorization Implementation checklist (consolidated) High-level summary (assessment snapshot)
  • Risk Score: 9.5/10 (Critical)
  • Critical issues identified:
    1. No authentication/authorization middleware — endpoints are unprotected beyond login.
    2. Weak JWT implementation — missing strict verification parameters; possible default secrets.
    3. No RBAC or object-level authorization — vulnerable to BOLA/IDOR.
    4. 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.
Concrete remediation snippets
  1. Authentication middleware (verify JWT)
  1. Issuing JWTs with recommended claims (login handler)
  1. Object-level ownership authorization (authorizeOwnership middleware)
  1. Applying middleware and enforcing authN -> authZ -> handler order
Proof-of-Concept (what the assessment demonstrated)
Recommended immediate actions (prioritized)
  1. 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.
  2. Implement and apply authentication middleware (jwt.verify with algorithms/issuer/audience) across all protected routes before any business logic.
  3. Add object-level ownership checks for all /:id and object-access routes; enforce deny-by-default for RBAC decisions.
  4. Audit and remove or strictly protect debug/admin routes (e.g., /seed, /reset, /debug) in production.
  5. Normalize error handling to avoid resource enumeration (use 404 for not-found and 403 for explicit access-denied where appropriate).
Full report and remediation expectations For each finding produce:
  • 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
Also produce a checklist diff marking each verification item as Pass / Fail / Not Applicable. Notes on LLM-generated code
  • 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.
Suggested follow-up reviews
  • 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.
Links and references

Watch Video