Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

s3tables: Validate bucket name in parseBucketNameFromARN()

Chris Lufb4fb8b082d6
diff --git a/weed/s3api/s3tables/utils.go b/weed/s3api/s3tables/utils.go
index 5cf218c13b..6fac9bb482 100644
--- a/weed/s3api/s3tables/utils.go
+++ b/weed/s3api/s3tables/utils.go
@@ -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