From a6967e7ef6386c5655a77e4c1125c4ce11341bac Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 10 Dec 2021 19:34:26 +0100 Subject: [PATCH] acl: Fix GetObjectACL xml parsing (#1598) A recent change introduced a regression in parsing Object ACL S3 API. This issue is not detected by minio-go functional tests since CI only runs it against MinIO where Object ACL is unsupported. Fix the regression and allow short testing of ObjectACL since MinIO supports a small subset of the spec. --- api-get-object-acl.go | 5 +++-- functional_tests.go | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/api-get-object-acl.go b/api-get-object-acl.go index b1291b6bc..9041d99e9 100644 --- a/api-get-object-acl.go +++ b/api-get-object-acl.go @@ -47,8 +47,9 @@ type AccessControlList struct { } type accessControlPolicy struct { - Owner - AccessControlList + XMLName xml.Name `xml:"AccessControlPolicy"` + Owner Owner + AccessControlList AccessControlList } // GetObjectACL get object ACLs diff --git a/functional_tests.go b/functional_tests.go index 49c664ae5..413b63e58 100644 --- a/functional_tests.go +++ b/functional_tests.go @@ -11430,12 +11430,6 @@ func testGetObjectACLContext() { // Seed random based on current time. rand.Seed(time.Now().Unix()) - // skipping region functional tests for non s3 runs - if os.Getenv(serverEndpoint) != "s3.amazonaws.com" { - ignoredLog(testName, function, args, startTime, "Skipped region functional tests for non s3 runs").Info() - return - } - // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ @@ -11512,6 +11506,17 @@ func testGetObjectACLContext() { return } + // Do a very limited testing if this is not AWS S3 + if os.Getenv(serverEndpoint) != "s3.amazonaws.com" { + if s[0] != "private" { + logError(testName, function, args, startTime, "", "GetObjectACL fail \"X-Amz-Acl\" expected \"private\" but got"+fmt.Sprintf("%q", s[0]), nil) + return + } + + successLogger(testName, function, args, startTime).Info() + return + } + if s[0] != "public-read-write" { logError(testName, function, args, startTime, "", "GetObjectACL fail \"X-Amz-Acl\" expected \"public-read-write\" but got"+fmt.Sprintf("%q", s[0]), nil) return @@ -12111,6 +12116,7 @@ func main() { // Default to KMS tests. kms = true } + // execute tests if isFullMode() { testMakeBucketErrorV2()