Skip to content

Commit df6c564

Browse files
rootulpgjermundgaraba
andauthoredMar 20, 2025··
test: JSON ack serialization non-determinism (#8073)
Co-authored-by: Gjermund Garaba <[email protected]>
1 parent 13ebd2f commit df6c564

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎modules/apps/transfer/ibc_module_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,21 @@ func (suite *TransferTestSuite) TestOnAcknowledgePacket() {
414414
errors.New("unable to unescrow tokens"),
415415
false,
416416
},
417+
{
418+
// See https://github.com/cosmos/ibc-go/security/advisories/GHSA-jg6f-48ff-5xrw
419+
"non-deterministic JSON ack serialization should return an error",
420+
func() {
421+
// Create a valid acknowledgement using deterministic serialization.
422+
ack = channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement()
423+
// Introduce non-determinism: insert an extra space after the first character '{'
424+
// This will deserialize correctly but fail to re-serialize to the expected bytes.
425+
if len(ack) > 0 && ack[0] == '{' {
426+
ack = []byte("{ " + string(ack[1:]))
427+
}
428+
},
429+
errors.New("acknowledgement did not marshal to expected bytes"),
430+
false,
431+
},
417432
}
418433

419434
for _, tc := range testCases {

0 commit comments

Comments
 (0)
Please sign in to comment.