Implement comprehensive access logging for security auditing#393
Merged
ISTIFANUS-N merged 1 commit intorinafcode:mainfrom Apr 23, 2026
Merged
Conversation
|
@Just-Bamford 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! 🚀 |
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
Implements a dedicated
AccessLoggermodule providing a unified, tamper-evident audit trail for all significant contract invocations across the TeachLink smart contract workspace.Problem
Access logging is currently insufficient for security auditing. Individual modules emit domain-specific events but there is no unified mechanism to:
Changes
New Module:
access_logger.rsAccessLogger::log_access— records every access attempt with caller, operation tag, outcome, and timestamp into persistent storageAccessLogger::get_log_entry— retrieves a single log entry by IDAccessLogger::get_total_log_count— returns total entries ever recordedAccessLogger::query_logs— conjunctive filter queries (caller, operation, outcome, time range) with most-recent-first orderingAccessLogger::get_temporal_pattern— returns per-address call count for a given hourly windowNew Types (
types.rs)AccessOutcomeenum —Success/Failure { error_code: u32 }AccessLogEntrystruct — immutable record per access attemptAuditQuerystruct — filter parameters for audit queriesNew Storage Keys (
storage.rs)LOG_COUNTER(persistent) — monotonically increasing entry IDACCESS_LOGS(persistent) — all log entries, survives TTL expiryACCESS_TEMPORAL(instance) — per-address hourly call countsNew Events (
events.rs)AccessAttemptEvent— emitted for every recorded entryAccessLogFailedEvent— emitted when a log write itself failsNew Errors (
errors.rs)AccessLogError—StorageWriteFailed,InvalidOperationTag,InvalidLimitAcceptance Criteria
AccessOutcomewith error code preservationAudit Trail Guarantees
Base
rinafcode/teachLink_contract:mainthis pr Closes #274