fix(python): normalize webhook signature hex comparison and handle case-insensitive headers - #41
Open
Adityakk9031 wants to merge 1 commit into
Open
Adityakk9031 wants to merge 1 commit into
Adityakk9031 wants to merge 1 commit into
Conversation
Author
|
@jaberjaber23 have a look |
This branch has not been deployed
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.
close #40
Description
Fixes issue #40 in the Python SDK (
runinfra):verify_webhook_signature()generated a lowercase hex digest usinghexdigest(), but compared it against incoming signatures directly withhmac.compare_digest(expected, signature). If an incoming webhook payload contained an uppercase hex signature string (e.g.v1=4F2A...),hmac.compare_digestfailed due to case-sensitive character comparison. Updated to comparesignature.lower()in constant time._Speech.createuseddict.get("content-type", dict.get("Content-Type", ...)). Updated to perform case-insensitive header matching across response header keys.Testing & Verification
test_construct_webhook_event_accepts_uppercase_hex_signaturetopython/tests/test_runinfra_sdk.py.Ran 159 tests in 0.975s - OK).node scripts/verify-version-sync.mjs: Version sync intact at0.2.0.