feat(contracts): add access logging to Access Control contract - #131
Open
Williams-1604 wants to merge 1 commit into
Open
feat(contracts): add access logging to Access Control contract#131Williams-1604 wants to merge 1 commit into
Williams-1604 wants to merge 1 commit into
Conversation
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
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 existingauditingmodule'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 loggedextend_access→"extended"revoke_access→"revoked"get_access_logs(grantee, resource_id)— returns the full ordered log (emptyVecif none).Acceptance criteria
Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test --features testutils(121 passed, incl. 4 new integration tests), andcargo build --release --target wasm32-unknown-unknownall pass locally.Closes #87