Repository navigation
🐛 fix parameter verifications in HMAC method - #439
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The HMAC validation updates still allow whitespace-only secret keys and include avoidable dead/culture-sensitive casing logic that should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR tightens and expands HMAC signature validation behavior in BaseLocalResponse and updates the unit tests around local response parsing and job/error response parsing metadata to better reflect expected behavior.
Changes:
- Adjusts
IsValidHmacSignatureparameter checks and adds additional HMAC validation cases in unit tests (null/empty/uppercase signature). - Updates XML documentation strings around local response constructors.
- Refactors/renames several unit tests and updates
[Trait]/[Fact(DisplayName=...)]metadata for clearer categorization.
File summaries
| File | Description |
|---|---|
| tests/Mindee.UnitTests/V2/Parsing/LocalResponseTest.cs | Adds more IsValidHmacSignature assertions (null/empty/uppercase) and renames test methods. |
| tests/Mindee.UnitTests/V2/Parsing/JobTest.cs | Updates test categorization metadata and moves helper method for readability. |
| tests/Mindee.UnitTests/V2/Parsing/ErrorResponseTest.cs | Adds test categorization metadata and improves test display name. |
| src/Mindee/Parsing/BaseLocalResponse.cs | Updates constructor XML docs and tightens HMAC signature validation logic. |
Review details
Suppressed comments (2)
src/Mindee/Parsing/BaseLocalResponse.cs:133
- The
expectedSignature == ""guard is unreachable with the currentGetHmacSignatureimplementation (it always returns a non-empty hex string). Keeping this branch adds dead code and makes the method harder to reason about.
string expectedSignature = GetHmacSignature(secretKey);
if (expectedSignature == "")
return false;
src/Mindee/Parsing/BaseLocalResponse.cs:136
signature.ToLower()is culture-sensitive; for a header value that should be ASCII/hex, normalize usingToLowerInvariant()to avoid any locale-dependent behavior.
byte[] actualBytes = Encoding.UTF8.GetBytes(signature.ToLower());
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ianardee
force-pushed
the
hmac-fixes
branch
2 times, most recently
from
September 7, 2026 11:22
66d24a6 to
be54dae
Compare
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.
Description
Types of changes