[DRK-114] Harden DKNet.Svc.Encryption hashing: _disposed visibility + ignoreCase no-op docs - #338
Merged
Merged
Conversation
- HmacHashing and ShaHashing _disposed fields are now volatile so a Dispose() on one thread is deterministically visible to a Compute/ Verify/Dispose read on another - IHmacHashing/IShaHashing VerifySha256/VerifySha512 ignoreCase param docs corrected: the flag has no effect on the comparison result Co-authored-by: multica-agent <github@multica.ai>
…ing and ShaHashing Co-authored-by: multica-agent <github@multica.ai>
📊 Code Coverage Report |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #338 +/- ##
==========================================
+ Coverage 78.65% 78.82% +0.17%
==========================================
Files 169 169
Lines 4155 4147 -8
Branches 609 607 -2
==========================================
+ Hits 3268 3269 +1
+ Misses 703 697 -6
+ Partials 184 181 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
Author
PR Review — #338: DKNet.Svc.Encryption hardeningScore: 10.0 / 10 → APPROVED SummaryA textbook small, focused hardening change. Two low-risk fixes confined to two files ( Score breakdown
Weighted average: 10.0/10 · No hard caps triggered. FindingsPraise
Preconditions check
Out-of-scope observation
|
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
Low-priority hardening from the SEC-006 constant-time-compare review follow-ups (DRK-114):
HmacHashing._disposedandShaHashing._disposedare nowvolatile—Dispose()writes are deterministically visible toCompute/Verifyreads on another thread, without adding locking to the hot paths.ignoreCase<param>XML docs onIHmacHashing.VerifySha256/VerifySha512andIShaHashing.VerifySha256/VerifySha512to state the flag has no effect on the result (comparisons useCryptographicOperations.FixedTimeEqualson decoded bytes, which are always compared exactly).Tests
HmacHashingDisposeTests/ShaHashingDisposeTests— dispose-then-verify throwsObjectDisposedExceptiondeterministically.HmacHashingIgnoreCaseTests/ShaHashingIgnoreCaseTests—ignoreCase: true/falsereturn identical results for a mixed-case expected signature/hex string.HmacHashing98.1%,ShaHashing98.1%.dotnet packclean.Scope
src/Services/DKNet.Svc.Encryption/{HmacHashing.cs,ShaHashing.cs}+ 4 new test files undersrc/Services/Svc.Encryption.Tests/.