Repository navigation
AUD-01: audit writer contract, event catalog and validator (S-02) - #42
Merged
Merged
Conversation
jevt1c
requested review from
VanjaSigma,
VelikiVojvoda,
cvetko1e,
mladenkovacevic901 and
owlCoder
November 3, 2026 01:07
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.
Component and requirement IDs
Changes
Proposes the central audit contract (status: DRAFT, version 0.1) and enforces it in code.
docs/components/audit/CONTRACTS.md: the contract, event catalog, limits, producer obligations, consumers, residual risk and open questions.Platform.Audit/Contracts:IAuditWriter,ITrustedAuditWriter,AuditEventDraft, actor/context types,AuditWriteResultwith stable rejection codes,AuditEventTypes, andAuditEventCatalog(schema version 1, 10 event types).Platform.Audit/Application: internalAuditDraftValidatorandAuditDetailFormats.Platform.Audit.csproj:InternalsVisibleTofor the test project only.Not in this PR: the writer itself, storage, DI registration (S-05, S-06),
FakeAuditWriter, and any change to Identity or Access code.Verification
dotnet test backend/SecurityLab.slnx --configuration ReleasePlatform.Audit.Tests: 71 tests, 67 of them new (T03). Identity tests (42) unchanged and passing.Architecture and data flow
No component diagrams changed in this PR; they are S-18/S-20. Dependency direction is unchanged:
Platform.Accessdoes not referencePlatform.Audit; onlyPlatform.Audit.Contractstypes are public.Security checks and negative tests
AuditDraftValidatorTests(positive case per event type, plus negative cases for type, outcome, actor, correlation, course, resource and details) andAuditEventCatalogTests(catalog, constants and examples stay in sync; no secret-like keys).ITrustedAuditWriteris public, so forged context is prevented by code review, not the compiler (documented in CONTRACTS.md).Dependencies
AuditDraftValidatorbefore storing.IAuditWriterinPlatform.Api.Services.Identity; adapter or switch is open question 1 in CONTRACTS.md (D1). Access is connected through the host adapter (S-13).