feat(large-messages): add optional allowedBuckets allowlist#2555
Open
phipag wants to merge 2 commits into
Open
feat(large-messages): add optional allowedBuckets allowlist#2555phipag wants to merge 2 commits into
phipag wants to merge 2 commits into
Conversation
Add an opt-in bucket allowlist to the v2 large messages utility. The S3 bucket in the message pointer is controlled by the sender, so this gives consumers fine-grained, in-application control over which buckets the utility may read from and delete, complementing IAM permissions. Configure via LargeMessageConfig.withAllowedBuckets(Set). When a non-empty allowlist is set, a message whose pointer names a bucket outside the allowlist is rejected with LargeMessageProcessingException before any S3 interaction. An empty allowlist (default) preserves the existing behavior, so the change is backward compatible and applies to both the @LargeMessage annotation and the functional API. Includes unit tests, an e2e handler and negative e2e test, and docs with a security note, resource-scoped IAM example, and usage examples.
Contributor
Dependency ReviewThe following issues were found:
|
Avoid exposing the internal set reference (SpotBugs EI_EXPOSE_REP).
|
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
Changes
Adds an opt-in bucket allowlist to the v2 large messages utility. The S3 bucket in the large-message pointer is supplied by the message sender, so this gives consumers fine-grained, in-application control over which buckets the utility reads from and deletes, complementing plain IAM permissions with a defense-in-depth layer that lives next to their handler configuration.
Configure it through the existing
LargeMessageConfigsingleton:When a non-empty allowlist is configured, the utility rejects any message whose pointer names a bucket outside the allowlist by throwing
LargeMessageProcessingExceptionbefore any S3 read or delete. An empty allowlist (the default) applies no restriction, so the change is fully backward compatible. It works for both the@LargeMessageannotation and the functionalLargeMessages.processLargeMessage(...)API.Details:
LargeMessageConfig.withAllowedBuckets(Set<String>)/getAllowedBuckets(), with the test-only reset clearing it.LargeMessageProcessorvalidates the pointer's bucket against the allowlist before fetching/deleting.largemessage-restrictede2e handler and a negative e2e test asserting an offloaded message from a non-allowlisted bucket is neither processed nor deleted.allowedBucketsusage for both APIs.Issue number: #2554
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.