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
master
Harshavardhana 8 years ago committed by GitHub
parent c1a6ca0c33
commit 0543d45fb3
  1. 7
      cmd/api-response.go
  2. 2
      cmd/auth-rpc-server_test.go
  3. 2
      cmd/bucket-notification-handlers_test.go
  4. 4
      cmd/event-notifier_test.go
  5. 13
      cmd/globals.go
  6. 2
      cmd/object-api-multipart_test.go
  7. 3
      cmd/server_test.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

@ -77,7 +77,7 @@ func TestLogin(t *testing.T) {
// Invalid password length
{
args: LoginRPCArgs{
Username: globalMinioDefaultOwnerID,
Username: "minio",
Password: "aaa",
Version: Version,
},

@ -185,7 +185,7 @@ func testGetBucketNotificationHandler(obj ObjectLayer, instanceType, bucketName
filterRules := []filterRule{
{
Name: "prefix",
Value: globalMinioDefaultOwnerID,
Value: "minio",
},
{
Name: "suffix",

@ -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",

@ -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"

@ -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{
{

@ -1619,7 +1619,8 @@ func (s *TestSuiteCommon) TestListObjectsHandler(c *C) {
c.Assert(err, IsNil)
c.Assert(strings.Contains(string(getContent), "<Key>bar</Key>"), Equals, true)
c.Assert(strings.Contains(string(getContent), "<Owner><ID>minio</ID><DisplayName>minio</DisplayName></Owner>"), Equals, true)
c.Assert(strings.Contains(string(getContent), fmt.Sprintf("<Owner><ID>%s</ID><DisplayName></DisplayName></Owner>",
globalMinioDefaultOwnerID)), Equals, true)
}

Loading…
Cancel
Save