Skip to content

feat(contracts): add access logging to Access Control contract - #131

Open
Williams-1604 wants to merge 1 commit into
GuardZero144:mainfrom
Williams-1604:feat/access-control-logging-87
Open

feat(contracts): add access logging to Access Control contract#131
Williams-1604 wants to merge 1 commit into
GuardZero144:mainfrom
Williams-1604:feat/access-control-logging-87

Conversation

@Williams-1604

Copy link
Copy Markdown

Summary

Adds access logging to the Access Control contract (Closes #87).

The contract already implemented permission management (grant_access/get_permission), access control (check_access), time-based access (access_expiry), and revocation (revoke_access) — the one gap against the acceptance criteria was access logging.

What's added

  • AccessLogEntry (new type) — { grantee, resource_id, action, timestamp }.
  • AccessDataKey::Logs(Address, u64) — persistent storage key for the per-(grantee, resource_id) log, following the existing auditing module's persistent-log pattern.
  • log_access (internal) — appends an entry; called from every mutating/checking path:
    • grant_access"granted"
    • check_access"checked" (allowed) or "denied" (missing/expired/inactive) — both outcomes are logged
    • extend_access"extended"
    • revoke_access"revoked"
  • get_access_logs(grantee, resource_id) — returns the full ordered log (empty Vec if none).

Acceptance criteria

  • Permissions work (pre-existing)
  • Access is controlled (pre-existing)
  • Time limits work (pre-existing)
  • Revocation works (pre-existing)
  • Access is logged (new)

Verification

cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test --features testutils (121 passed, incl. 4 new integration tests), and cargo build --release --target wasm32-unknown-unknown all pass locally.

Closes #87

The Access Control contract already covered permission management,
access checks, time-based expiry, and revocation, but had no access
logging. Add an append-only access log per (grantee, resource_id):

- log_access (internal) appends an AccessLogEntry recording the action
  ("granted", "checked", "denied", "extended", "revoked") and timestamp
- get_access_logs retrieves the full log for a grantee/resource pair
- grant_access, check_access, extend_access, and revoke_access each
  record an entry — check_access logs both granted and denied attempts

New AccessLogEntry type and AccessDataKey::Logs storage key follow the
existing auditing module's persistent-storage-backed log pattern. 4 new
integration tests cover grant+check, denied checks, revoke+extend
ordering, and the empty-log case.

Closes GuardZero144#87
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@CelestinaBeing is attempting to deploy a commit to the Josie's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Medium] Implement Access Control contract

2 participants