Skip to content

Access control & audit improvements - #552

Merged
OxDev-max merged 5 commits into
OpenLedger-Foundation:mainfrom
Mimah97:feature/access-control-audit-improvements
Jul 28, 2026
Merged

Access control & audit improvements#552
OxDev-max merged 5 commits into
OpenLedger-Foundation:mainfrom
Mimah97:feature/access-control-audit-improvements

Conversation

@Mimah97

@Mimah97 Mimah97 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR addresses four critical security and compliance gaps in the access control and audit logging systems:

  1. Multisig execution validation parity — The multisig execute_action path now enforces the same validation checks as direct admin paths for GrantRole and TransferAdmin operations.
  2. Enumerable role registry — Adds an on-chain, paginated registry allowing off-chain tooling to discover current role holders without replaying events.
  3. Audit entry payload — AdminAuditEntry now captures what changed (target address, role, value) in addition to who acted and when.
  4. Multisig recovery mechanism — Implements a long-timelock (30-day) recovery path for lost-key scenarios, allowing reconfiguration if quorum becomes unreachable.

Changes

#494 — Multisig validation gaps

  • Extracted validation logic into validate_grant_role_target() and validate_transfer_admin_target() helpers
  • execute_action's GrantRole and TransferAdmin arms now enforce identical checks to direct paths
  • Added tests: multisig GrantRole to admin rejected, TransferAdmin to self/operator rejected

#493 — Enumerable role registry

  • Added DataKey::RoleMembers(Role) -> Vec<Address> storage key
  • Maintained alongside role mutations in grant_role, revoke_role, and execute_action
  • Added get_role_members(role, page, page_size) -> Vec<Address> paginated view
  • Tests verify consistency through grant/revoke/re-grant cycles and multisig execution

#491 — Audit entry payload

  • Added details: Bytes field to AdminAuditEntry for serialized action metadata
  • Updated all 11 append_audit_entry call sites to populate payload:
    • GrantRole/RevokeRole: target + role
    • TransferAdmin: new admin address
    • ProposeParameter/ExecuteParameter: key + new_value
    • ProposeUpgrade/ExecuteUpgrade: wasm hash
    • ConfigureMultisig: threshold + signer count
    • Pause/Unpause: empty payload
  • Tests verify payload presence and correctness

#492 — Multisig recovery mechanism

  • Added RecoveryProposal struct and recovery proposal DataKeys
  • Implemented three-method flow:
    • propose_signer_recovery() — Any signer can initiate
    • object_signer_recovery() — Signers can prevent execution
    • execute_signer_recovery() — Executes after 30-day timelock with no objections
  • Recovery execution reconfigures MultisigConfig atomically
  • Tests cover: proposal, objection, early execution rejection, objection blocking execution, non-signer rejection

Test Coverage

✅ All existing tests continue to pass
✅ New tests for multisig validation parity
✅ New tests for role registry pagination and consistency
✅ New tests for audit entry payloads
✅ New tests for recovery mechanism lifecycle

Notes

  • No new dependencies or external APIs
  • All changes backward-compatible at execution level (AdminAuditEntry schema change is incompatible for existing entries, but documented as a migration requirement)
  • Code-only delivery: no install/build/test/scripts run during implementation
  • Committer: Mimah97

Closes #494, Closes #493, Closes #491, Closes #492

@OxDev-max
OxDev-max merged commit 7c0ac52 into OpenLedger-Foundation:main Jul 28, 2026
1 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment