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
This commit is contained in:
Harshavardhana 2017-06-20 15:01:13 -07:00 committed by GitHub
parent c1a6ca0c33
commit 0543d45fb3
7 changed files with 18 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,16 @@ const (
globalMinioCertExpireWarnDays = time.Hour * 24 * 30 // 30 days.
globalMinioDefaultRegion = ""
globalMinioDefaultOwnerID = "minio"
// 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 S3only 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"

View File

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

View File

@ -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)
}