RBAC implemented with least privilege
Why it matters
Without role-based access control, every authenticated user has the same permissions as an administrator — a regular user can delete records, reassign roles, or exfiltrate all data through unguarded API endpoints. NIST 800-53 rev5 AC-2 (Account Management) requires formal role definitions, and AC-6 (Least Privilege) mandates that users receive only the minimum access required for their function. CWE-285 (Improper Authorization) and OWASP A01 (Broken Access Control) consistently rank this as the most exploited web application vulnerability. Frontend-only role gates are bypassed by any direct API call using the browser's developer tools.
Severity rationale
High because absent server-side permission checks allow any authenticated user to perform privileged operations simply by calling the API directly, bypassing every UI-level guard.
Remediation
Define roles and permissions in a central module, then enforce them in every sensitive API handler — never on the client alone.
// lib/rbac.ts
export const PERMISSIONS = {
admin: ['read', 'write', 'delete', 'manage_users'],
auditor: ['read', 'write'],
viewer: ['read']
} as const
export function requirePermission(
userRole: keyof typeof PERMISSIONS,
action: string
) {
if (!PERMISSIONS[userRole]?.includes(action)) {
throw new Response(null, { status: 403 })
}
}
// app/api/admin/users/route.ts
export const DELETE = async (req: Request) => {
const session = await getServerSession()
requirePermission(session.user.role, 'manage_users')
// ... proceed
}
Log every role assignment and escalation event per NIST AU-2 requirements. Run permission checks in src/middleware.ts for route-level protection in addition to handler-level checks.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the FISMA/FedRAMP Readiness Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- nist:rev5 · AC-2 — Account Management
- nist:rev5 · AC-6 — Least Privilege
- fedramp:rev5 · AC-6 — FedRAMP AC-6 — least privilege enforcement
- cwe · CWE-285 — Improper Authorization
- owasp:2021 · A01 — Broken Access Control
- soc2:2017 · CC6.3 — Role-based access and least privilege
Taxons
History
- 2026-04-18·v1.0.0·Initial import from gov-fisma-fedramp·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.3) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2