From c57a2dc4c25130ee67f5e943eefef93f222d20a5 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 6 Jul 2018 11:09:59 -0700 Subject: [PATCH] update minio-go dependency to support single statement policies (#2480) --- vendor/github.com/minio/minio-go/api.go | 2 +- .../minio-go/pkg/policy/bucket-policy.go | 10 ++++-- vendor/vendor.json | 36 +++++++++---------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/vendor/github.com/minio/minio-go/api.go b/vendor/github.com/minio/minio-go/api.go index 237ddbca..5856ed2b 100644 --- a/vendor/github.com/minio/minio-go/api.go +++ b/vendor/github.com/minio/minio-go/api.go @@ -99,7 +99,7 @@ type Options struct { // Global constants. const ( libraryName = "minio-go" - libraryVersion = "v6.0.3" + libraryVersion = "v6.0.5" ) // User Agent should always following the below style. diff --git a/vendor/github.com/minio/minio-go/pkg/policy/bucket-policy.go b/vendor/github.com/minio/minio-go/pkg/policy/bucket-policy.go index 9d5f5b3f..79fd8019 100644 --- a/vendor/github.com/minio/minio-go/pkg/policy/bucket-policy.go +++ b/vendor/github.com/minio/minio-go/pkg/policy/bucket-policy.go @@ -557,7 +557,6 @@ func GetPolicy(statements []Statement, bucketName string, prefix string) BucketP } else { matchedObjResources = s.Resources.FuncMatch(resourceMatch, objectResource) } - if !matchedObjResources.IsEmpty() { readOnly, writeOnly := getObjectPolicy(s) for resource := range matchedObjResources { @@ -571,7 +570,8 @@ func GetPolicy(statements []Statement, bucketName string, prefix string) BucketP matchedResource = resource } } - } else if s.Resources.Contains(bucketResource) { + } + if s.Resources.Contains(bucketResource) { commonFound, readOnly, writeOnly := getBucketPolicy(s, prefix) bucketCommonFound = bucketCommonFound || commonFound bucketReadOnly = bucketReadOnly || readOnly @@ -605,6 +605,7 @@ func GetPolicies(statements []Statement, bucketName, prefix string) map[string]B } } } + // Pretend that policy resource as an actual object and fetch its policy for r := range objResources { // Put trailing * if exists in asterisk @@ -613,7 +614,10 @@ func GetPolicies(statements []Statement, bucketName, prefix string) map[string]B r = r[:len(r)-1] asterisk = "*" } - objectPath := r[len(awsResourcePrefix+bucketName)+1:] + var objectPath string + if len(r) >= len(awsResourcePrefix+bucketName)+1 { + objectPath = r[len(awsResourcePrefix+bucketName)+1:] + } p := GetPolicy(statements, bucketName, objectPath) policyRules[bucketName+"/"+objectPath+asterisk] = p } diff --git a/vendor/vendor.json b/vendor/vendor.json index 1dcf8d13..27efa483 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -56,46 +56,46 @@ "revisionTime": "2015-10-24T22:24:27-07:00" }, { - "checksumSHA1": "PkOKsTgaHxkGse3bo45bHUnsoMc=", + "checksumSHA1": "qmCEhMpDtl8rzdoxAlK9pz/rkek=", "path": "github.com/minio/minio-go", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { - "checksumSHA1": "/Ly8Mgi802nx7zZiBq+H6p+ct8M=", + "checksumSHA1": "Qsj+6JPmJ8R5rFNQSHqRb8xAwOw=", "path": "github.com/minio/minio-go/pkg/credentials", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { "checksumSHA1": "Md5pOKYfoKtrG7xNvs2FtiDPfDc=", "path": "github.com/minio/minio-go/pkg/encrypt", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { - "checksumSHA1": "Df4SG4ratsLn8yE9SkHcZiKhKRU=", + "checksumSHA1": "6D/qMFV+e39L+6aeT+Seq1guohM=", "path": "github.com/minio/minio-go/pkg/policy", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { "checksumSHA1": "bbWjcrOQsV57qK+BSsrNAsI+Q/o=", "path": "github.com/minio/minio-go/pkg/s3signer", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { - "checksumSHA1": "qftVikC9NYZ40HFUccTYg1p1M/Y=", + "checksumSHA1": "xrJThFwwkVrJdwd5iYFHqfx4wRY=", "path": "github.com/minio/minio-go/pkg/s3utils", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { "checksumSHA1": "Wt8ej+rZXTdNBR9Xyw1eGo3Iq5o=", "path": "github.com/minio/minio-go/pkg/set", - "revision": "33b767f5638ccaf7cc30516ec54024d3e58a8209", - "revisionTime": "2018-06-20T05:12:25Z" + "revision": "70799fe8dae6ecfb6c7d7e9e048fce27f23a1992", + "revisionTime": "2018-07-05T14:57:19Z" }, { "checksumSHA1": "MEC+K9aTG+8tfPjnJ4qj2Y+kc4s=",