Repository navigation
Improve SnsMessageManager message parsing, certificate handling and signature validation - #7495
Queued
alextwoods wants to merge 8 commits into
Queued
alextwoods wants to merge 8 commits into
alextwoods wants to merge 8 commits into
Conversation
Limit concurrent certificate downloads, close the response body on error responses, and validate additional SigningCertURL components.
Cache signing certificates by content rather than URL, share the endpoint URL validation rules, and validate message fields before retrieving the certificate.
Read SNS messages with the streaming parser and skip fields the message manager does not use. Depend on third-party-jackson-core directly instead of json-utils.
Require the signed fields to be present and single-line, and validate SubscribeURL and UnsubscribeURL against the regional SNS endpoint.
alextwoods
force-pushed
the
alexwoo/limit-certificate-fetches
branch
from
October 29, 2026 21:58
e4100f1 to
ff6fa22
Compare
zoewangg
reviewed
Nov 2, 2026
Validate SigningCertURL through the shared endpoint validator and remove the SubscribeURL and UnsubscribeURL host checks, verify a signature prepared once against each cached certificate, bound the decoded signature length, and consolidate the test fixtures and HTTP client stubs.
zoewangg
approved these changes
Nov 2, 2026
dagnir
approved these changes
Nov 2, 2026
alextwoods
enabled auto-merge
November 2, 2026 22:04
…n CertificateRetrieverTest
alextwoods
added this pull request to the merge queue
Nov 2, 2026
Any commits made after this event will not be merged.
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.
Improve SnsMessageManager parsing, certificate handling and validation
Motivation and Context
Follow-up hardening of the
sns-message-managermodule. Message parsing, certificate retrieval and field validation inSnsMessageManagerwere reworked to be more robust and to do less work for messages that cannot validate.Modifications
SigningCertURL. Before a certificate is fetched, the message signature is checked against the certificates already cached; a fetch only happens when none of them verifies. Concurrent downloads are bounded, concurrent requests for the same URL are collapsed into one, and response bodies are closed on error responses.SigningCertURLare shared through a new internalSnsEndpointUrlValidatorand also applied toSubscribeURLandUnsubscribeURL.SigningCertURLpath and query remain unconstrained.Signature,SignatureVersion,TimestampandSigningCertURLmust be present and well formed before the certificate is retrieved. Signed fields other thanMessagemust be present and single-line. Unsupported signature versions and missing fields now fail withSdkClientExceptioninstead ofIllegalArgumentException/NullPointerException.SnsMessageUnmarshallerreads the message with the streaming JSON parser and copies only the fields the message manager uses; other fields are skipped. Malformed JSON and non-object bodies fail withSdkClientException.Public API is unchanged. Messages delivered by Amazon SNS are unaffected;
Messagemay still contain line breaks.Testing
New and existing unit tests.
Types of changes
License