Skip to content

fix: role-based access control separation for payment router admin - #981

Open
emmixeryng wants to merge 6 commits into
Abdulazeem-code:mainfrom
emmixeryng:security/issue-892-contract-role-based-access-control-rbac
Open

emmixeryng wants to merge 6 commits into
Abdulazeem-code:mainfrom
emmixeryng:security/issue-892-contract-role-based-access-control-rbac

Conversation

@emmixeryng

Copy link
Copy Markdown

Overview

This PR introduces granular Role-Based Access Control (RBAC) to the payment_router contract, replacing the single shared admin/multi-sig authority with three distinct roles: FeeManager, SecurityOfficer, and UpgradeManager. Each administrative method is now gated to its designated role, enforcing the principle of least privilege across fee, security, and upgrade operations.

Related Issue

Changes

🔐 RBAC Separation

  • [MODIFY] payment_router/src/access.rs

    • Added Role enum with FeeManager, SecurityOfficer, and UpgradeManager variants.
    • Added DataKey::Role(Role, Address) storage key holding a boolean role assignment.
    • Added role grant/revoke helpers and a require_role guard used by administrative entrypoints.
    • Mapped each administrative method to its designated role: fee parameter setters → FeeManager; pause/unpause → SecurityOfficer; contract upgrade → UpgradeManager.
  • [MODIFY] payment_router/src/lib.rs

    • Wired the new role guards into the administrative entrypoints so each method enforces its designated role before mutating state.
    • Fee setters remain bounded to their configured limits; pause/unpause and upgrade paths are restricted to their respective roles.
  • [MODIFY] payment_router/src/errors.rs

    • Added an authorization error variant returned when a caller lacks the required role.

Verification Results

cargo test -p payment_router
✅ access role tests passed
✅ fee manager permission checks passed
✅ security officer permission checks passed
✅ upgrade manager permission checks passed
Acceptance Criteria Status
DataKey::Role(Role, Address) stores boolean role assignments ✅ Implemented in access.rs
SecurityOfficer can pause/unpause but cannot change fees ✅ Enforced via role guard on pause/unpause; fee setters reject non-FeeManager
FeeManager can set fee parameters within bounds but cannot pause or upgrade ✅ Bounded fee setters gated to FeeManager; pause/upgrade reject non-designated roles
Tests assert permission checks for each role variant ✅ Permission checks covered for all three role variants

Closes #892

@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown

@emmixeryng is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Abdulazeem-code

Copy link
Copy Markdown
Owner

Kindly resolve conflicts

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@emmixeryng Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@emmixeryng

Copy link
Copy Markdown
Author

@Abdulazeem-code — this PR is ready for another review. I fixed the failing CI checks on this PR (pushed 7b066c8).
Files changed: payment_router/src/lib.rs, payment_router/src/storage.rs, payment_router/src/errors.rs

@emmixeryng
emmixeryng force-pushed the security/issue-892-contract-role-based-access-control-rbac branch from 5f348d0 to d58e301 Compare October 22, 2026 06:59
Strips the payload this branch picked up (deleted api.js, truncated payment-dashboard/vite.config.js, unhooked package.json). No functional change to the branch's own work.

This branch has not been deployed

No deployments
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.

[Contract] Role-Based Access Control (RBAC) Separation for Financial vs Security Administration

2 participants