s3tables: Validate bucket name in parseBucketNameFromARN()
Enforce the same bucket name validation rules (length, characters, reserved prefixes/suffixes) when extracting from ARN. This prevents accepting ARNs that the system would never create and ensures consistency with CreateTableBucket validation.
This commit is contained in:
@@ -30,7 +30,11 @@ func parseBucketNameFromARN(arn string) (string, error) {
|
||||
if len(matches) != 2 {
|
||||
return "", fmt.Errorf("invalid bucket ARN: %s", arn)
|
||||
}
|
||||
return matches[1], nil
|
||||
bucketName := matches[1]
|
||||
if !isValidBucketName(bucketName) {
|
||||
return "", fmt.Errorf("invalid bucket name in ARN: %s", bucketName)
|
||||
}
|
||||
return bucketName, nil
|
||||
}
|
||||
|
||||
// parseTableFromARN extracts bucket name, namespace, and table name from ARN
|
||||
|
||||
Reference in New Issue
Block a user