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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix(s3api): require space in v2 auth prefix (#9852)
7y-925f36cd13dee
diff --git a/weed/s3api/auth_signature_v2.go b/weed/s3api/auth_signature_v2.goindex 786243f84c..9f2167c43c 100644--- a/weed/s3api/auth_signature_v2.go+++ b/weed/s3api/auth_signature_v2.go@@ -239,7 +239,8 @@ func validateV2AuthHeader(v2Auth string) (accessKey string, errCode s3err.ErrorC// Signature V2 authorization header format:// Authorization: AWS AKIAIOSFODNN7EXAMPLE:frJIUN8DYpKDtOLCwo//yllqDzg=- if !strings.HasPrefix(v2Auth, signV2Algorithm) {+ const signV2AlgorithmPrefix = signV2Algorithm + " "+ if !strings.HasPrefix(v2Auth, signV2AlgorithmPrefix) {return "", s3err.ErrSignatureVersionNotSupported}diff --git a/weed/s3api/auth_signature_v2_test.go b/weed/s3api/auth_signature_v2_test.goindex d876c5abe0..01b7156aab 100644--- a/weed/s3api/auth_signature_v2_test.go+++ b/weed/s3api/auth_signature_v2_test.go@@ -57,6 +57,11 @@ func TestValidateV2AuthHeader(t *testing.T) {authHeader: "HMAC AKIAIOSFODNN7EXAMPLE:signature",expectedError: s3err.ErrSignatureVersionNotSupported,},+ {+ name: "algorithm prefix without space",+ authHeader: "AWSXAKIAIOSFODNN7EXAMPLE:signature",+ expectedError: s3err.ErrSignatureVersionNotSupported,+ },{name: "missing colon separator",authHeader: "AWS AKIAIOSFODNN7EXAMPLE",@@ -232,7 +237,7 @@ func TestDoesSignV2Match(t *testing.T) {query: "",headers: map[string]string{"Date": "Mon, 09 Sep 2011 23:36:00 GMT"},authOverride: "AWSAKIAIOSFODNN7EXAMPLE:signature==",- expectedError: s3err.ErrInvalidAccessKeyID,+ expectedError: s3err.ErrSignatureVersionNotSupported,expectIdent: false,},}