Skip to content
MergeShieldDemo

Like what you see? Sign up with GitHub to start governing your own repos — free forever.

Back to Pull Requests

Implement user role permissions

cursor[bot]Cursor18 files
55/100 High

Files Changed

18

Additions

+890

Deletions

-120

Agent

Cursor

Risk analysis complete.Score: 55/100
GitHub

Summary

RBAC implementation across API — moderate risk from middleware changes affecting all routes.

Model: claude-sonnet-4-20250514Duration: 13200msTokens: 4600
Was this analysis helpful?

Risk Scores

Overall55/100
Complexity50/100
Security65/100
Blast Radius60/100
Test Coverage45/100
Breaking Change40/100

File-Level Risk

FileRiskCategoryDetails
src/middleware/rbac.ts65securityCore RBAC middleware with permission checking logic
src/models/user-roles.ts55breaking ChangeNew roles schema with migration
src/routes/admin.ts50securityAdmin-only routes with role escalation prevention
src/middleware/auth.ts45blast RadiusAuth middleware now chains with RBAC checks

security

65/100

Findings

  • Role-based access control with 4 permission levels (admin, owner, member, viewer)
  • Permission checks added to 12 API routes via middleware
  • Role escalation prevention: users cannot assign higher roles than their own

Suggestions

  • Add audit logging for all permission changes
  • Consider row-level security for database queries as defense in depth

blast Radius

60/100

Findings

  • Middleware change affects all 12 protected API routes
  • Database schema adds roles column with NOT NULL constraint
  • Existing users default to 'member' role — may need admin bootstrap

Suggestions

  • Add migration script to set initial admin users
  • Feature flag for gradual rollout of permission enforcement

complexity

50/100

Findings

  • Permission hierarchy with inheritance (admin inherits owner permissions)
  • Composable middleware pattern for flexible permission combinations
  • 18 files changed but well-organized by feature

Suggestions

  • Extract permission constants into shared enum for consistency
Interactive Demo | MergeShield