From 0543d45fb3eac610e042f51f57e5d6339f17deb9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 20 Jun 2017 15:01:13 -0700 Subject: [PATCH] fix: OwnerID in response should be 64 character in length. (#4554) Rather than sending a custom "minio" string, we can change this to `sha256('arn:aws:iam::minio:user/admin')`. Fixes #4553 --- cmd/api-response.go | 7 ------- cmd/auth-rpc-server_test.go | 2 +- cmd/bucket-notification-handlers_test.go | 2 +- cmd/event-notifier_test.go | 4 ++-- cmd/globals.go | 13 +++++++++++-- cmd/object-api-multipart_test.go | 2 +- cmd/server_test.go | 3 ++- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/cmd/api-response.go b/cmd/api-response.go index a75d7325c..9e139b9d7 100644 --- a/cmd/api-response.go +++ b/cmd/api-response.go @@ -288,8 +288,6 @@ func generateListBucketsResponse(buckets []BucketInfo) ListBucketsResponse { var owner = Owner{} owner.ID = globalMinioDefaultOwnerID - owner.DisplayName = globalMinioDefaultOwnerID - for _, bucket := range buckets { var listbucket = Bucket{} listbucket.Name = bucket.Name @@ -312,8 +310,6 @@ func generateListObjectsV1Response(bucket, prefix, marker, delimiter string, max var data = ListObjectsResponse{} owner.ID = globalMinioDefaultOwnerID - owner.DisplayName = globalMinioDefaultOwnerID - for _, object := range resp.Objects { var content = Object{} if object.Name == "" { @@ -360,7 +356,6 @@ func generateListObjectsV2Response(bucket, prefix, token, nextToken, startAfter, if fetchOwner { owner.ID = globalMinioDefaultOwnerID - owner.DisplayName = globalMinioDefaultOwnerID } for _, object := range objects { @@ -443,9 +438,7 @@ func generateListPartsResponse(partsInfo ListPartsInfo) ListPartsResponse { listPartsResponse.UploadID = partsInfo.UploadID listPartsResponse.StorageClass = globalMinioDefaultStorageClass listPartsResponse.Initiator.ID = globalMinioDefaultOwnerID - listPartsResponse.Initiator.DisplayName = globalMinioDefaultOwnerID listPartsResponse.Owner.ID = globalMinioDefaultOwnerID - listPartsResponse.Owner.DisplayName = globalMinioDefaultOwnerID listPartsResponse.MaxParts = partsInfo.MaxParts listPartsResponse.PartNumberMarker = partsInfo.PartNumberMarker diff --git a/cmd/auth-rpc-server_test.go b/cmd/auth-rpc-server_test.go index 39ec686c0..81e4ea9e0 100644 --- a/cmd/auth-rpc-server_test.go +++ b/cmd/auth-rpc-server_test.go @@ -77,7 +77,7 @@ func TestLogin(t *testing.T) { // Invalid password length { args: LoginRPCArgs{ - Username: globalMinioDefaultOwnerID, + Username: "minio", Password: "aaa", Version: Version, }, diff --git a/cmd/bucket-notification-handlers_test.go b/cmd/bucket-notification-handlers_test.go index c1b7c9ebf..5d095f39d 100644 --- a/cmd/bucket-notification-handlers_test.go +++ b/cmd/bucket-notification-handlers_test.go @@ -185,7 +185,7 @@ func testGetBucketNotificationHandler(obj ObjectLayer, instanceType, bucketName filterRules := []filterRule{ { Name: "prefix", - Value: globalMinioDefaultOwnerID, + Value: "minio", }, { Name: "suffix", diff --git a/cmd/event-notifier_test.go b/cmd/event-notifier_test.go index 4b2087417..c8408c4b9 100644 --- a/cmd/event-notifier_test.go +++ b/cmd/event-notifier_test.go @@ -312,7 +312,7 @@ func TestInitEventNotifier(t *testing.T) { filterRules := []filterRule{ { Name: "prefix", - Value: globalMinioDefaultOwnerID, + Value: "minio", }, { Name: "suffix", @@ -535,7 +535,7 @@ func TestAddRemoveBucketListenerConfig(t *testing.T) { filterRules := []filterRule{ { Name: "prefix", - Value: globalMinioDefaultOwnerID, + Value: "minio", }, { Name: "suffix", diff --git a/cmd/globals.go b/cmd/globals.go index b57457b9c..297afec14 100644 --- a/cmd/globals.go +++ b/cmd/globals.go @@ -29,8 +29,17 @@ import ( const ( globalMinioCertExpireWarnDays = time.Hour * 24 * 30 // 30 days. - globalMinioDefaultRegion = "" - globalMinioDefaultOwnerID = "minio" + globalMinioDefaultRegion = "" + // This is a sha256 output of ``arn:aws:iam::minio:user/admin``, + // this is kept in present form to be compatible with S3 owner ID + // requirements - + // + // ``` + // The canonical user ID is the Amazon S3–only concept. + // It is 64-character obfuscated version of the account ID. + // ``` + // http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example4.html + globalMinioDefaultOwnerID = "02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4" globalMinioDefaultStorageClass = "STANDARD" globalWindowsOSName = "windows" globalNetBSDOSName = "netbsd" diff --git a/cmd/object-api-multipart_test.go b/cmd/object-api-multipart_test.go index 4a6281657..044c06428 100644 --- a/cmd/object-api-multipart_test.go +++ b/cmd/object-api-multipart_test.go @@ -1061,7 +1061,7 @@ func testListMultipartUploads(obj ObjectLayer, instanceType string, t TestErrHan { MaxUploads: 10, IsTruncated: false, - Prefix: globalMinioDefaultOwnerID, + Prefix: "minio", UploadIDMarker: uploadIDs[4], Uploads: []uploadMetadata{ { diff --git a/cmd/server_test.go b/cmd/server_test.go index 097f1f9cf..cfb07c9e6 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -1619,7 +1619,8 @@ func (s *TestSuiteCommon) TestListObjectsHandler(c *C) { c.Assert(err, IsNil) c.Assert(strings.Contains(string(getContent), "bar"), Equals, true) - c.Assert(strings.Contains(string(getContent), "miniominio"), Equals, true) + c.Assert(strings.Contains(string(getContent), fmt.Sprintf("%s", + globalMinioDefaultOwnerID)), Equals, true) }