Fix SNS timestamp serialization to preserve millisecond precision - #1162
Open
DebadityaHait wants to merge 1 commit into
Open
Fix SNS timestamp serialization to preserve millisecond precision#1162DebadityaHait wants to merge 1 commit into
DebadityaHait wants to merge 1 commit into
Conversation
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.
# Fix SNS timestamp serialization to preserve millisecond precision
Summary
Fix SNS timestamp serialization so whole-second timestamps retain
.000milliseconds.Chrono omits the fractional component when serializing a
DateTime<Utc>that falls exactly on a whole second. For SNS messages, that changes the serialized timestamp from forms such as:2025-01-01T12:34:56.000Zto:
2025-01-01T12:34:56ZBecause the SNS signature is computed over the original string representation, this changes the SNS string-to-sign and can cause signature verification to fail.
Fix
Serialize the SNS
DateTime<Utc>timestamp fields using RFC 3339 with fixed millisecond precision.This ensures timestamps consistently retain three fractional digits, including
.000, while leaving deserialization behavior and the public Rust types unchanged.The change applies to:
SnsMessageSnsSubscriptionMessageSnsMessageObjRegression coverage
Added coverage verifying that:
.000Zsurvives a serialization/deserialization round-trip without losing its millisecond component;Validation
cargo fmt --all -- --checkpassed-D warningsFull all-target Clippy is currently blocked by unrelated pre-existing warnings in API Gateway/fixture tests.
Fixes #1161