Implement comprehensive access logging for security auditing#398
Merged
Xhristin3 merged 5 commits intoApr 28, 2026
Conversation
- Add AccessOutcome, AccessLogEntry, AuditQuery types to types.rs - Add LOG_COUNTER, ACCESS_LOGS, ACCESS_TEMPORAL storage keys to storage.rs - Add AccessAttemptEvent, AccessLogFailedEvent events to events.rs - Add AccessLogError (500-502) to errors.rs - Create access_logger.rs with AccessLogger module: - log_access: persistent entry storage + hourly temporal window tracking - get_log_entry: retrieve entry by ID (no auth required) - get_total_log_count: monotonic counter (no auth required) - query_logs: conjunctive filters, most-recent-first, limit-capped - get_temporal_pattern: per-address hourly call count - Wire AccessLogger into lib.rs as public contract entry points - Append-only design: no delete/modify functions exposed
|
@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! 🚀 |
Contributor
Author
|
Kindly review and merge this PR. Ongoing changes are causing recurring conflicts. |
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-evidentaudit trail for all significant contract invocations across the TeachLink smart
contract workspace.
Problem
Access logging is insufficient for security auditing. Individual modules emit
domain-specific events but there is no unified mechanism to:
this pr Closes #267
Changes
New Module:
access_logger.rsAccessLogger::log_access— records every access attempt with caller,operation tag, outcome, and timestamp into persistent storage
AccessLogger::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 ordering
AccessLogger::get_temporal_pattern— returns per-address call count fora given hourly window
New 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 (500),InvalidOperationTag (501),InvalidLimit (502)Acceptance Criteria
AccessOutcomewith error code preservationAudit Trail Guarantees
Base
rinafcode/teachLink_contract:main