Role-Based Access Control (RBAC) & Audit Trail Implementation
Implement multi-tenant permissions, role hierarchies, and tamper-resistant audit logs.
Implement granular multi-tenant Role-Based Access Control (RBAC) with permission guards, middleware, and append-only audit trail logs.
Execution Workflow Procedure
Ordered steps the coding agent executes when performing this skill.
Design Permission Matrix & Role Hierarchy
Define granular permissions (e.g. documents:read, documents:delete) and role mappings (Admin, Editor, Viewer).
Implement Authorization Middleware & Decorators
Create type-safe permission guards and decorators to enforce checks at the API controller layer.
Build Append-Only Audit Trail Logging
Capture who, what, when, IP address, and changed diffs in an append-only audit_logs database table.
Agent Safety Guardrails & Anti-Hallucination Rules
- DO NOT hardcode role names inside business logic; check specific granular permissions instead.
- DO NOT allow audit log records to be updated or deleted by standard application users.
Expected Output Format
Permission schema, authorization middleware, and audit logger.
Domain Verification Checks
Example Agent Invocations
Install / Configure This Skill
# Place in .cursorrules or create .cursor/rules/rbac-audit-trail-implementation.mdc # Trigger: Whenever you perform role-based access control (rbac) & audit trail implementation --- name: rbac-audit-trail-implementation description: Implement multi-tenant Role-Based Access Control (RBAC) and append-only audit trail logging. version: 1.0.0 compatibility: [Cursor, Claude Code, Cline, Roo Code, Antigravity] --- # Role-Based Access Control (RBAC) & Audit Trail Implementation ## Objective Implement type-safe RBAC authorization and tamper-resistant audit trail logging for enterprise multi-tenant applications. ## Workflow 1. **Permission Matrix**: Define granular permission keys and role hierarchies. 2. **Authorization Guards**: Enforce permission checks at controller and service boundaries. 3. **Audit Trail**: Record user actions, tenant IDs, timestamps, and payload diffs in append-only tables.
Need a quick one-time prompt for chat?
Try the Security Vulnerability & OWASP Code Audit — a lightweight version designed for 1-click copying directly into Claude, ChatGPT, or Cursor chat.
SprintKit Workflow Integrations
Complementary tools and checklists to pair with this agent workflow.
Related Agent Skills
Explore related procedural workflows in this discipline.
Application Security & OWASP Top 10 Audit
Audit backend and frontend code for injection, authentication flaws, IDOR, SSRF, and sensitive data leakage.
Jira User Story to Vertical-Slice Implementation Loop
Transform Jira user stories and acceptance criteria into vertically sliced, test-backed code implementations.
Strict TypeScript Type Safety & Soundness Audit
Audit TypeScript code for type safety, type narrowing, generics, mutation traps, and runtime boundary validation.