fix: preserve signed content-digest key in JSON messages#614
Open
droter wants to merge 1 commit intopermaweb:edgefrom
Open
fix: preserve signed content-digest key in JSON messages#614droter wants to merge 1 commit intopermaweb:edgefrom
content-digest key in JSON messages#614droter wants to merge 1 commit intopermaweb:edgefrom
Conversation
When decoding HTTP messages, `content-digest` was unconditionally removed from the message map before commitment verification. This caused HMAC commitment verification to fail for JSON messages that included `content-digest` as part of their signed fields. This fix applies the same pattern used for `ao-body-key`: check if `content-digest` is a signed key before removing it. If it was part of the commitment, it is preserved for verification. Reproducer: - Send a JSON message with a `data` field and explicit `content-digest` - The hbsig library computes content-digest for the data field - HyperBEAM strips content-digest before HMAC verification - Verification fails with `invalid_commitment` This is similar to the fix in PR permaweb#610 for `content-type` preservation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
b0eaf0f to
448bdbc
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.
When decoding HTTP messages,
content-digestwas unconditionally removed from the message map before commitment verification. This caused HMAC commitment verification to fail for JSON messages that includedcontent-digestas part of their signed fields.This fix applies the same pattern used for
ao-body-key: check ifcontent-digestis a signed key before removing it. If it was part of the commitment, it is preserved for verification.Reproducer:
datafield and explicitcontent-digestinvalid_commitmentThis is similar to the fix in PR #610 for
content-typepreservation.closes issue #615