Turning 3 Pen-Test Findings into a 66-Endpoint Authorization Overhaul
The Trigger
A routine penetration test flagged what looked like a minor UI bug: a read-only user could open three administrator pages by typing their URLs directly.
Instead of patching only those three routes, I inspected the authorization layer end to end—and found a structural gap.
Automated Full-Stack Audit
Two permission fields in the backend RBAC table had never been wired into the enforcement middleware, leaving a raw role list as the sole barrier—while the frontend router performed no role checks at all.
Rather than auditing hundreds of endpoints by hand, I wrote a scanner across the backend permission matrix and frontend route tree. The scan surfaced:
- 66 write operations executable by read-only roles.
- 38 of those write operations directly exposed via REST APIs.
- 421 frontend routes lacking consistent role-based route guards.
Systematic Remediation
- Backend enforcement: Tightened 70 backend RBAC rules so every write endpoint enforces strict role authorization regardless of how the request arrives.
- Frontend defense in depth: Generated and verified role guards across all 421 frontend routes directly from the authoritative menu tree.
- Safe delivery: Packaged the fix as a clean, reversible hotfix with automated verification tests.
Takeaway
When a pen-test finds 3 authorization bugs, treat it as a symptom of a missing invariant—write a scanner to find all 66 instead of playing whack-a-mole.
Enjoyed this note or seen a similar bug?
Feel free to drop a line—always glad to exchange ideas with fellow engineers.