Skip to content

security: enforce RBAC on all entity CRUD handlers#44

Merged
NeuroKoder3 merged 1 commit intomainfrom
security/enforce-rbac-entity-handlers
Mar 27, 2026
Merged

security: enforce RBAC on all entity CRUD handlers#44
NeuroKoder3 merged 1 commit intomainfrom
security/enforce-rbac-entity-handlers

Conversation

@NeuroKoder3
Copy link
Owner

Summary

Fixes the Broken Access Control (BAC) vulnerability — the last critical security gap identified in the enterprise production readiness assessment.

Before: The entity CRUD handlers only checked whether a session was active. Any authenticated user — including viewers and regulators — could create, modify, or delete any entity type by calling the IPC channel directly.

After: Every handler now calls enforcePermission before proceeding. This function checks the user role against the RBAC permission matrix defined in accessControl.cjs.

Permission mapping covers all 14 entity types:

Entity View Create Update Delete
Patient patient:view patient:create patient:update patient:delete
DonorOrgan donor:view donor:create donor:update donor:delete
Match match:view match:create match:update blocked
AuditLog audit:view blocked blocked blocked
User user:manage user:manage user:manage user:manage
NotificationRule open settings:manage settings:manage settings:manage
EHR entities open system:configure system:configure system:configure
ReadinessBarrier patient:view patient:update patient:update patient:delete

Test plan

  • Verify viewer role cannot create/update/delete patients
  • Verify coordinator role can create patients but not delete
  • Verify admin role has full access to all entities
  • Verify regulator role has read-only access
  • Verify existing tests still pass

…bility)

The entity:create, entity:get, entity:update, entity:delete, entity:list, and entity:filter IPC handlers previously only checked session validity, allowing any authenticated user (including viewers) to mutate data.

Now every handler calls enforcePermission() which checks the user's role against the RBAC matrix in accessControl.cjs before allowing the operation. Each entity type maps to specific permissions for view/create/update/delete actions.
@NeuroKoder3 NeuroKoder3 merged commit f818e13 into main Mar 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant