Problem
contracts/manage_hub/src/subscription.rs (line 1048) contains a // TODO: Add admin check here comment marking a function that executes privileged subscription management operations without verifying the caller has admin authority. This is a security gap — any caller can invoke admin-only subscription operations on-chain without restriction.
Proposed Solution
Add an admin authorization check at line 1048 using the existing access control pattern already used elsewhere in the ManageHub contracts. The access_control contract (contracts/access_control/src/lib.rs) defines role-based access helpers that other contracts use via cross-contract calls.
Steps:
- Review how other admin-guarded functions in
manage_hub/src/lib.rs verify admin access (look for existing require_admin() or role-check patterns)
- Replicate the same pattern at line 1048 in
subscription.rs — invoke the AccessControl client to verify the env.invoker() has the Admin or SuperAdmin role before proceeding
- If the caller does not have the required role, the function must panic with a descriptive error:
"Unauthorized: admin role required"
- Add a test case in
contracts/manage_hub/src/test.rs that verifies a non-admin caller is rejected
Acceptance Criteria
Problem
contracts/manage_hub/src/subscription.rs(line 1048) contains a// TODO: Add admin check herecomment marking a function that executes privileged subscription management operations without verifying the caller has admin authority. This is a security gap — any caller can invoke admin-only subscription operations on-chain without restriction.Proposed Solution
Add an admin authorization check at line 1048 using the existing access control pattern already used elsewhere in the ManageHub contracts. The
access_controlcontract (contracts/access_control/src/lib.rs) defines role-based access helpers that other contracts use via cross-contract calls.Steps:
manage_hub/src/lib.rsverify admin access (look for existingrequire_admin()or role-check patterns)subscription.rs— invoke theAccessControlclient to verify theenv.invoker()has theAdminorSuperAdminrole before proceeding"Unauthorized: admin role required"contracts/manage_hub/src/test.rsthat verifies a non-admin caller is rejectedAcceptance Criteria
subscription.rsusing the existing access control pattern"Unauthorized"panic// TODOcomment is removed after the check is implemented