[Phase 1] Canonical Request Signing — Deterministic HMAC Across SDKs#33
Open
RachanaB5 wants to merge 3 commits into
Open
[Phase 1] Canonical Request Signing — Deterministic HMAC Across SDKs#33RachanaB5 wants to merge 3 commits into
RachanaB5 wants to merge 3 commits into
Conversation
Contributor
Author
|
Added additional canonicalization and interop tests based on discussion. |
Contributor
Author
|
Updated tests and addressed feedback around assertions, wrapper usage, and Unicode normalization. Would appreciate maintainer feedback on the overall approach. |
8 tasks
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
Implements JSON canonicalization before HMAC computation to ensure deterministic signing across the Python SDK and Go sidecar. Previously, semantically identical JSON with different key ordering or whitespace would produce different HMAC signatures, breaking cross-platform verification.
Closes #32 .
Problem
Payloads were signed as raw bytes without canonicalization, causing HMAC verification to fail when the same JSON was serialized differently across SDKs.
Solution
Canonicalize JSON (sorted keys, no whitespace) before signing on both sides, guaranteeing identical HMAC input regardless of serialization order.
Changes
sidecar/internal/transport/frame.goSignedMessage()now parses, canonicalizes JSON, returns([]byte, error)sidecar/internal/transport/listener.gohandleConn()with structured loggingsidecar/internal/transport/frame_test.gosdk/python/acf/frame.pysigned_message()canonicalizes viajson.dumps(sort_keys=True, separators=(',', ':'))sdk/python/tests/test_frame.pyNet: +209 lines, -18 lines across 5 files
Go —
frame.goPython —
frame.pyTest Results
Updates
Notes
Would appreciate feedback on whether deriving canonical length inside
SignedMessage()aligns with the intended design.