Conversation
Reconciliation persistence now runs in one transaction inside the execution strategy (or joins a caller-owned transaction), guards every finding update with its ConcurrencyStamp, inserts findings only when the key is absent, and reads active and resolvable findings in a single query. Conflicts raise DbUpdateConcurrencyException and roll back the whole run. Audit value canonicalization now expands byte[] (hex), collections (JSON array), and DateTime/DateTimeOffset (round-trip), so binary values no longer hash or truncate to "System.Byte[]". The Hash disposition is documented as an integrity-only digest with no confidentiality for low-entropy values. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
cdcavell
deleted the
fix/audit-reconciliation-concurrency-and-hash-canonicalization
branch
September 21, 2026 23:53
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
1. Audit reconciliation writes (HIGH)
ApplicationAuditReconciler.PersistCandidatesAsync:CreateExecutionStrategy(), the same patternRecordRemediationAsyncuses. If the caller already owns a transaction, the run joins it.UPDATEnow includesAND [ConcurrencyStamp] = @original. Zero rows affected →DbUpdateConcurrencyException, and the whole run rolls back.INSERT ... SELECT ... WHERE NOT EXISTS (FindingKey). If an interleaved run already inserted the key, the result is a concurrency conflict, not a unique-index violation. On SQL Server, a true simultaneous insert can still hit the unique index. The run still rolls back cleanly, and the hosted service retries on the next cycle.2. Audit value protection (HIGH)
Hashdisposition is kept for compatibility (existing policies use it for high-entropy IDs). The enum and the method are now documented as an integrity / change-detection digest with no confidentiality for low-entropy values. They point toHmacSha256instead.ToCanonicalStringnow handlesbyte[]/Memory<byte>as hex,DateTime/DateTimeOffsetin round-tripOformat (the old format dropped sub-second precision), otherIFormattablevalues in invariant culture, and non-stringIEnumerableas a JSON array of canonical elements. Binary columns no longer collapse to"System.Byte[]".Behavior change: digests and truncated text for byte[], collection, and DateTime values differ from earlier releases. String and numeric digests are unchanged, which the existing golden-hash tests confirm. This is noted in the CHANGELOG.
Tests
dotnet build -c Release(warnings as errors) passes;dotnet test: 455/455 passed.🤖 Generated with Claude Code