s3: reject reserved bucket name "filemeta" (#9760)

filemeta is the filer SQL store's default table name. A bucket of that
name passes VerifyS3BucketName but is rejected by the store's isValidBucket
guard on every operation, so it creates fine yet can't be deleted and wedges
fsck. Reject it at creation so both checks agree.
This commit is contained in:
Chris Lu
2026-05-31 11:15:05 -07:00
committed by GitHub
parent 6b06fe5ec4
commit 35ab67fa8a
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -7,11 +7,19 @@ import (
"unicode"
)
// Reserved because it is the default table/collection name of the filer
// store; a bucket of the same name collides with it and wedges the bucket
// (cannot be deleted, breaks fsck) on SQL backends with per-bucket tables.
const reservedBucketName = "filemeta"
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
func VerifyS3BucketName(name string) (err error) {
if len(name) < 3 || len(name) > 63 {
return fmt.Errorf("bucket name must between [3, 63] characters")
}
if name == reservedBucketName {
return fmt.Errorf("bucket name %q is reserved", name)
}
for idx, ch := range name {
if !(unicode.IsLower(ch) || ch == '.' || ch == '-' || unicode.IsNumber(ch)) {
return fmt.Errorf("bucket name can only contain lower case characters, numbers, dots, and hyphens")
+1
View File
@@ -17,6 +17,7 @@ func Test_verifyBucketName(t *testing.T) {
"grehtrry-",
"----------",
"x@fdsgr032",
"filemeta",
}
for _, invalidName := range invalidS3BucketNames {
err := VerifyS3BucketName(invalidName)