fix(service/s3/validators): validate empty bucket to prevent panic in dnsCompatibleBucketName method#3377
Open
hanagantig wants to merge 1 commit intoaws:mainfrom
Open
fix(service/s3/validators): validate empty bucket to prevent panic in dnsCompatibleBucketName method#3377hanagantig wants to merge 1 commit intoaws:mainfrom
hanagantig wants to merge 1 commit intoaws:mainfrom
Conversation
Collaborator
|
Unfortunately, you are making code changes to a generated file. See the first line of that file The service model is the source of truth for this, and it's owned by S3 directly, not by the SDK, so we can't accept this PR. You can create an issue and we can own reaching out to S3 about adding this validation on their model. THAT SAID, it seems like the issue you are facing is with one of our customizations on |
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.
Description
Fixes panic when
Bucketis empty inPutObjectinput validation.The SDK currently allows an empty string bucket (
"") to pass validation, which later leads to a panic indnsCompatibleBucketNamedue to direct indexing (bucket[0]).Before (bug):
Bucket == nilis validatedBucket == ""passes validationbucket[0]After (fix):
Bucket == nilandBucket == ""are treated as invalidRoot Cause
In
dnsCompatibleBucketName, the function assumes a non-empty string and directly accessesbucket[0]:When
bucket == "", this results in an out-of-bounds access and causes a runtime panic.The validation layer (
validateOpPutObjectInput) only checks fornilpointers, but does not validate empty string values, allowing invalid input to propagate.Fix
Extend validation in
validateOpPutObjectInputto reject empty bucket names:Result