Update to minio/pkg/v2 (#17967)

This commit is contained in:
Aditya Manthramurthy 2023-09-04 12:57:37 -07:00 committed by GitHub
parent 71c32e9b48
commit 1c99fb106c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
166 changed files with 413 additions and 417 deletions

View File

@ -25,7 +25,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// Data types used for returning dummy access control // Data types used for returning dummy access control

View File

@ -41,8 +41,7 @@ import (
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
iampolicy "github.com/minio/pkg/iam/policy"
) )
const ( const (
@ -58,7 +57,7 @@ const (
func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SetBucketQuotaAdminAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SetBucketQuotaAdminAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -110,7 +109,7 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *
func (a adminAPIHandlers) GetBucketQuotaConfigHandler(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) GetBucketQuotaConfigHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.GetBucketQuotaAdminAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.GetBucketQuotaAdminAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -148,7 +147,7 @@ func (a adminAPIHandlers) SetRemoteTargetHandler(w http.ResponseWriter, r *http.
update := r.Form.Get("update") == "true" update := r.Form.Get("update") == "true"
// Get current object layer instance. // Get current object layer instance.
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SetBucketTargetAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SetBucketTargetAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -291,7 +290,7 @@ func (a adminAPIHandlers) ListRemoteTargetsHandler(w http.ResponseWriter, r *htt
arnType := vars["type"] arnType := vars["type"]
// Get current object layer instance. // Get current object layer instance.
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.GetBucketTargetAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.GetBucketTargetAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -325,7 +324,7 @@ func (a adminAPIHandlers) RemoveRemoteTargetHandler(w http.ResponseWriter, r *ht
arn := vars["arn"] arn := vars["arn"]
// Get current object layer instance. // Get current object layer instance.
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SetBucketTargetAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SetBucketTargetAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -365,7 +364,7 @@ func (a adminAPIHandlers) ExportBucketMetadataHandler(w http.ResponseWriter, r *
bucket := pathClean(r.Form.Get("bucket")) bucket := pathClean(r.Form.Get("bucket"))
// Get current object layer instance. // Get current object layer instance.
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ExportBucketMetadataAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.ExportBucketMetadataAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -647,7 +646,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
ctx := r.Context() ctx := r.Context()
// Get current object layer instance. // Get current object layer instance.
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ImportBucketMetadataAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.ImportBucketMetadataAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -853,7 +852,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
continue continue
} }
bucketPolicy, err := policy.ParseConfig(bytes.NewReader(bucketPolicyBytes), bucket) bucketPolicy, err := policy.ParseBucketPolicyConfig(bytes.NewReader(bucketPolicyBytes), bucket)
if err != nil { if err != nil {
rpt.SetStatus(bucket, fileName, err) rpt.SetStatus(bucket, fileName, err)
continue continue
@ -1021,7 +1020,7 @@ func (a adminAPIHandlers) ReplicationDiffHandler(w http.ResponseWriter, r *http.
vars := mux.Vars(r) vars := mux.Vars(r)
bucket := vars["bucket"] bucket := vars["bucket"]
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ReplicationDiff) objectAPI, _ := validateAdminReq(ctx, w, r, policy.ReplicationDiff)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -1083,7 +1082,7 @@ func (a adminAPIHandlers) ReplicationMRFHandler(w http.ResponseWriter, r *http.R
vars := mux.Vars(r) vars := mux.Vars(r)
bucket := vars["bucket"] bucket := vars["bucket"]
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ReplicationDiff) objectAPI, _ := validateAdminReq(ctx, w, r, policy.ReplicationDiff)
if objectAPI == nil { if objectAPI == nil {
return return
} }

View File

@ -27,7 +27,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
"github.com/minio/minio/internal/config" "github.com/minio/minio/internal/config"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
// validateAdminReq will validate request against and return whether it is allowed. // validateAdminReq will validate request against and return whether it is allowed.

View File

@ -38,7 +38,7 @@ import (
"github.com/minio/minio/internal/config/subnet" "github.com/minio/minio/internal/config/subnet"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
// DelConfigKVHandler - DELETE /minio/admin/v3/del-config-kv // DelConfigKVHandler - DELETE /minio/admin/v3/del-config-kv

View File

@ -33,8 +33,8 @@ import (
"github.com/minio/minio/internal/config/identity/openid" "github.com/minio/minio/internal/config/identity/openid"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" "github.com/minio/pkg/v2/ldap"
"github.com/minio/pkg/ldap" iampolicy "github.com/minio/pkg/v2/policy"
) )
func addOrUpdateIDPHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, isUpdate bool) { func addOrUpdateIDPHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, isUpdate bool) {

View File

@ -25,7 +25,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
// ListLDAPPolicyMappingEntities lists users/groups mapped to given/all policies. // ListLDAPPolicyMappingEntities lists users/groups mapped to given/all policies.

View File

@ -26,7 +26,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
var ( var (

View File

@ -33,15 +33,14 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
iampolicy "github.com/minio/pkg/iam/policy"
) )
// SiteReplicationAdd - PUT /minio/admin/v3/site-replication/add // SiteReplicationAdd - PUT /minio/admin/v3/site-replication/add
func (a adminAPIHandlers) SiteReplicationAdd(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationAdd(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, cred := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationAddAction) objectAPI, cred := validateAdminReq(ctx, w, r, policy.SiteReplicationAddAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -75,7 +74,7 @@ func (a adminAPIHandlers) SiteReplicationAdd(w http.ResponseWriter, r *http.Requ
func (a adminAPIHandlers) SRPeerJoin(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerJoin(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, cred := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationAddAction) objectAPI, cred := validateAdminReq(ctx, w, r, policy.SiteReplicationAddAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -97,7 +96,7 @@ func (a adminAPIHandlers) SRPeerJoin(w http.ResponseWriter, r *http.Request) {
func (a adminAPIHandlers) SRPeerBucketOps(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerBucketOps(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationOperationAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationOperationAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -144,7 +143,7 @@ func (a adminAPIHandlers) SRPeerBucketOps(w http.ResponseWriter, r *http.Request
func (a adminAPIHandlers) SRPeerReplicateIAMItem(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerReplicateIAMItem(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationOperationAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationOperationAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -163,7 +162,7 @@ func (a adminAPIHandlers) SRPeerReplicateIAMItem(w http.ResponseWriter, r *http.
if item.Policy == nil { if item.Policy == nil {
err = globalSiteReplicationSys.PeerAddPolicyHandler(ctx, item.Name, nil, item.UpdatedAt) err = globalSiteReplicationSys.PeerAddPolicyHandler(ctx, item.Name, nil, item.UpdatedAt)
} else { } else {
policy, perr := iampolicy.ParseConfig(bytes.NewReader(item.Policy)) policy, perr := policy.ParseConfig(bytes.NewReader(item.Policy))
if perr != nil { if perr != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, perr), r.URL) writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, perr), r.URL)
return return
@ -196,7 +195,7 @@ func (a adminAPIHandlers) SRPeerReplicateIAMItem(w http.ResponseWriter, r *http.
func (a adminAPIHandlers) SRPeerReplicateBucketItem(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerReplicateBucketItem(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationOperationAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationOperationAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -220,7 +219,7 @@ func (a adminAPIHandlers) SRPeerReplicateBucketItem(w http.ResponseWriter, r *ht
if item.Policy == nil { if item.Policy == nil {
err = globalSiteReplicationSys.PeerBucketPolicyHandler(ctx, item.Bucket, nil, item.UpdatedAt) err = globalSiteReplicationSys.PeerBucketPolicyHandler(ctx, item.Bucket, nil, item.UpdatedAt)
} else { } else {
bktPolicy, berr := policy.ParseConfig(bytes.NewReader(item.Policy), item.Bucket) bktPolicy, berr := policy.ParseBucketPolicyConfig(bytes.NewReader(item.Policy), item.Bucket)
if berr != nil { if berr != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, berr), r.URL) writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, berr), r.URL)
return return
@ -265,7 +264,7 @@ func (a adminAPIHandlers) SRPeerReplicateBucketItem(w http.ResponseWriter, r *ht
func (a adminAPIHandlers) SiteReplicationInfo(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationInfo(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationInfoAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationInfoAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -285,7 +284,7 @@ func (a adminAPIHandlers) SiteReplicationInfo(w http.ResponseWriter, r *http.Req
func (a adminAPIHandlers) SRPeerGetIDPSettings(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerGetIDPSettings(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationAddAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationAddAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -322,7 +321,7 @@ func parseJSONBody(ctx context.Context, body io.Reader, v interface{}, encryptio
func (a adminAPIHandlers) SiteReplicationStatus(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationStatus(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationInfoAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationInfoAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -351,7 +350,7 @@ func (a adminAPIHandlers) SiteReplicationStatus(w http.ResponseWriter, r *http.R
func (a adminAPIHandlers) SiteReplicationMetaInfo(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationMetaInfo(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationInfoAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationInfoAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -373,7 +372,7 @@ func (a adminAPIHandlers) SiteReplicationMetaInfo(w http.ResponseWriter, r *http
func (a adminAPIHandlers) SiteReplicationEdit(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationEdit(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, cred := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationAddAction) objectAPI, cred := validateAdminReq(ctx, w, r, policy.SiteReplicationAddAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -404,7 +403,7 @@ func (a adminAPIHandlers) SiteReplicationEdit(w http.ResponseWriter, r *http.Req
func (a adminAPIHandlers) SRPeerEdit(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerEdit(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationAddAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationAddAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -439,7 +438,7 @@ func getSRStatusOptions(r *http.Request) (opts madmin.SRStatusOptions) {
func (a adminAPIHandlers) SiteReplicationRemove(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationRemove(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationRemoveAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationRemoveAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -470,7 +469,7 @@ func (a adminAPIHandlers) SiteReplicationRemove(w http.ResponseWriter, r *http.R
func (a adminAPIHandlers) SRPeerRemove(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SRPeerRemove(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationRemoveAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationRemoveAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }
@ -492,7 +491,7 @@ func (a adminAPIHandlers) SRPeerRemove(w http.ResponseWriter, r *http.Request) {
func (a adminAPIHandlers) SiteReplicationResyncOp(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) SiteReplicationResyncOp(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.SiteReplicationResyncAction) objectAPI, _ := validateAdminReq(ctx, w, r, policy.SiteReplicationResyncAction)
if objectAPI == nil { if objectAPI == nil {
return return
} }

View File

@ -32,7 +32,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
minio "github.com/minio/minio-go/v7" minio "github.com/minio/minio-go/v7"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
func runAllIAMConcurrencyTests(suite *TestSuiteIAM, c *check) { func runAllIAMConcurrencyTests(suite *TestSuiteIAM, c *check) {

View File

@ -34,7 +34,7 @@ import (
"github.com/minio/minio/internal/config/dns" "github.com/minio/minio/internal/config/dns"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
// RemoveUser - DELETE /minio/admin/v3/remove-user?accessKey=<access_key> // RemoveUser - DELETE /minio/admin/v3/remove-user?accessKey=<access_key>

View File

@ -39,7 +39,7 @@ import (
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio-go/v7/pkg/signer" "github.com/minio/minio-go/v7/pkg/signer"
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
const ( const (

View File

@ -55,9 +55,9 @@ import (
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" "github.com/minio/pkg/v2/logger/message/log"
"github.com/minio/pkg/logger/message/log" xnet "github.com/minio/pkg/v2/net"
xnet "github.com/minio/pkg/net" iampolicy "github.com/minio/pkg/v2/policy"
"github.com/secure-io/sio-go" "github.com/secure-io/sio-go"
) )

View File

@ -47,7 +47,7 @@ import (
levent "github.com/minio/minio/internal/config/lambda/event" levent "github.com/minio/minio/internal/config/lambda/event"
"github.com/minio/minio/internal/event" "github.com/minio/minio/internal/event"
"github.com/minio/minio/internal/hash" "github.com/minio/minio/internal/hash"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// APIError structure // APIError structure

View File

@ -35,7 +35,7 @@ import (
"github.com/minio/minio/internal/hash" "github.com/minio/minio/internal/hash"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
xxml "github.com/minio/xxml" xxml "github.com/minio/xxml"
) )

View File

@ -27,7 +27,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
"github.com/rs/cors" "github.com/rs/cors"
) )

View File

@ -41,8 +41,7 @@ import (
xjwt "github.com/minio/minio/internal/jwt" xjwt "github.com/minio/minio/internal/jwt"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/mcontext" "github.com/minio/minio/internal/mcontext"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
iampolicy "github.com/minio/pkg/iam/policy"
) )
// Verify if request has JWT. // Verify if request has JWT.
@ -186,15 +185,15 @@ func validateAdminSignature(ctx context.Context, r *http.Request, region string)
// checkAdminRequestAuth checks for authentication and authorization for the incoming // checkAdminRequestAuth checks for authentication and authorization for the incoming
// request. It only accepts V2 and V4 requests. Presigned, JWT and anonymous requests // request. It only accepts V2 and V4 requests. Presigned, JWT and anonymous requests
// are automatically rejected. // are automatically rejected.
func checkAdminRequestAuth(ctx context.Context, r *http.Request, action iampolicy.AdminAction, region string) (auth.Credentials, APIErrorCode) { func checkAdminRequestAuth(ctx context.Context, r *http.Request, action policy.AdminAction, region string) (auth.Credentials, APIErrorCode) {
cred, owner, s3Err := validateAdminSignature(ctx, r, region) cred, owner, s3Err := validateAdminSignature(ctx, r, region)
if s3Err != ErrNone { if s3Err != ErrNone {
return cred, s3Err return cred, s3Err
} }
if globalIAMSys.IsAllowed(iampolicy.Args{ if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.Action(action), Action: policy.Action(action),
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
IsOwner: owner, IsOwner: owner,
Claims: cred.Claims, Claims: cred.Claims,
@ -248,7 +247,7 @@ func getClaimsFromTokenWithSecret(token, secret string) (map[string]interface{},
} }
// Check if a session policy is set. If so, decode it here. // Check if a session policy is set. If so, decode it here.
sp, spok := claims.Lookup(iampolicy.SessionPolicyName) sp, spok := claims.Lookup(policy.SessionPolicyName)
if spok { if spok {
// Looks like subpolicy is set and is a string, if set then its // Looks like subpolicy is set and is a string, if set then its
// base64 encoded, decode it. Decoding fails reject such // base64 encoded, decode it. Decoding fails reject such
@ -413,7 +412,7 @@ func authorizeRequest(ctx context.Context, r *http.Request, action policy.Action
if action != policy.ListAllMyBucketsAction && cred.AccessKey == "" { if action != policy.ListAllMyBucketsAction && cred.AccessKey == "" {
// Anonymous checks are not meant for ListAllBuckets action // Anonymous checks are not meant for ListAllBuckets action
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: action, Action: action,
@ -429,7 +428,7 @@ func authorizeRequest(ctx context.Context, r *http.Request, action policy.Action
if action == policy.ListBucketVersionsAction { if action == policy.ListBucketVersionsAction {
// In AWS S3 s3:ListBucket permission is same as s3:ListBucketVersions permission // In AWS S3 s3:ListBucket permission is same as s3:ListBucketVersions permission
// verify as a fallback. // verify as a fallback.
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
@ -446,10 +445,10 @@ func authorizeRequest(ctx context.Context, r *http.Request, action policy.Action
return ErrAccessDenied return ErrAccessDenied
} }
if action == policy.DeleteObjectAction && versionID != "" { if action == policy.DeleteObjectAction && versionID != "" {
if !globalIAMSys.IsAllowed(iampolicy.Args{ if !globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.Action(policy.DeleteObjectVersionAction), Action: policy.Action(policy.DeleteObjectVersionAction),
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
ObjectName: object, ObjectName: object,
@ -460,10 +459,10 @@ func authorizeRequest(ctx context.Context, r *http.Request, action policy.Action
return ErrAccessDenied return ErrAccessDenied
} }
} }
if globalIAMSys.IsAllowed(iampolicy.Args{ if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.Action(action), Action: action,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
ObjectName: object, ObjectName: object,
@ -477,10 +476,10 @@ func authorizeRequest(ctx context.Context, r *http.Request, action policy.Action
if action == policy.ListBucketVersionsAction { if action == policy.ListBucketVersionsAction {
// In AWS S3 s3:ListBucket permission is same as s3:ListBucketVersions permission // In AWS S3 s3:ListBucket permission is same as s3:ListBucketVersions permission
// verify as a fallback. // verify as a fallback.
if globalIAMSys.IsAllowed(iampolicy.Args{ if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
ObjectName: object, ObjectName: object,
@ -696,10 +695,10 @@ func isPutRetentionAllowed(bucketName, objectName string, retDays int, retDate t
conditions["object-lock-remaining-retention-days"] = []string{strconv.Itoa(retDays)} conditions["object-lock-remaining-retention-days"] = []string{strconv.Itoa(retDays)}
} }
if retMode == objectlock.RetGovernance && byPassSet { if retMode == objectlock.RetGovernance && byPassSet {
byPassSet = globalIAMSys.IsAllowed(iampolicy.Args{ byPassSet = globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.BypassGovernanceRetentionAction, Action: policy.BypassGovernanceRetentionAction,
BucketName: bucketName, BucketName: bucketName,
ObjectName: objectName, ObjectName: objectName,
ConditionValues: conditions, ConditionValues: conditions,
@ -707,10 +706,10 @@ func isPutRetentionAllowed(bucketName, objectName string, retDays int, retDate t
Claims: cred.Claims, Claims: cred.Claims,
}) })
} }
if globalIAMSys.IsAllowed(iampolicy.Args{ if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.PutObjectRetentionAction, Action: policy.PutObjectRetentionAction,
BucketName: bucketName, BucketName: bucketName,
ConditionValues: conditions, ConditionValues: conditions,
ObjectName: objectName, ObjectName: objectName,
@ -728,7 +727,7 @@ func isPutRetentionAllowed(bucketName, objectName string, retDays int, retDate t
// isPutActionAllowed - check if PUT operation is allowed on the resource, this // isPutActionAllowed - check if PUT operation is allowed on the resource, this
// call verifies bucket policies and IAM policies, supports multi user // call verifies bucket policies and IAM policies, supports multi user
// checks etc. // checks etc.
func isPutActionAllowed(ctx context.Context, atype authType, bucketName, objectName string, r *http.Request, action iampolicy.Action) (s3Err APIErrorCode) { func isPutActionAllowed(ctx context.Context, atype authType, bucketName, objectName string, r *http.Request, action policy.Action) (s3Err APIErrorCode) {
var cred auth.Credentials var cred auth.Credentials
var owner bool var owner bool
region := globalSite.Region region := globalSite.Region
@ -751,17 +750,17 @@ func isPutActionAllowed(ctx context.Context, atype authType, bucketName, objectN
// Do not check for PutObjectRetentionAction permission, // Do not check for PutObjectRetentionAction permission,
// if mode and retain until date are not set. // if mode and retain until date are not set.
// Can happen when bucket has default lock config set // Can happen when bucket has default lock config set
if action == iampolicy.PutObjectRetentionAction && if action == policy.PutObjectRetentionAction &&
r.Header.Get(xhttp.AmzObjectLockMode) == "" && r.Header.Get(xhttp.AmzObjectLockMode) == "" &&
r.Header.Get(xhttp.AmzObjectLockRetainUntilDate) == "" { r.Header.Get(xhttp.AmzObjectLockRetainUntilDate) == "" {
return ErrNone return ErrNone
} }
if cred.AccessKey == "" { if cred.AccessKey == "" {
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: policy.Action(action), Action: action,
BucketName: bucketName, BucketName: bucketName,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),
IsOwner: false, IsOwner: false,
@ -772,7 +771,7 @@ func isPutActionAllowed(ctx context.Context, atype authType, bucketName, objectN
return ErrAccessDenied return ErrAccessDenied
} }
if globalIAMSys.IsAllowed(iampolicy.Args{ if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: action, Action: action,

View File

@ -28,7 +28,7 @@ import (
"time" "time"
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
type nullReader struct{} type nullReader struct{}

View File

@ -26,7 +26,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
// healTask represents what to heal along with options // healTask represents what to heal along with options

View File

@ -34,7 +34,7 @@ import (
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/internal/config" "github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
const ( const (

View File

@ -47,10 +47,10 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/ioutil" "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
"github.com/minio/pkg/workers" "github.com/minio/pkg/v2/workers"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )

View File

@ -21,7 +21,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
) )
//go:generate msgp -file $GOFILE //go:generate msgp -file $GOFILE

View File

@ -34,8 +34,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
"github.com/minio/pkg/workers" "github.com/minio/pkg/v2/workers"
) )
// keyrotate: // keyrotate:

View File

@ -33,7 +33,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/rest" "github.com/minio/minio/internal/rest"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
const ( const (

View File

@ -30,7 +30,7 @@ import (
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
const ( const (

View File

@ -60,9 +60,8 @@ import (
"github.com/minio/minio/internal/ioutil" "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
iampolicy "github.com/minio/pkg/iam/policy" "github.com/minio/pkg/v2/sync/errgroup"
"github.com/minio/pkg/sync/errgroup"
) )
const ( const (
@ -367,10 +366,10 @@ func (api objectAPIHandlers) ListBucketsHandler(w http.ResponseWriter, r *http.R
// Use the following trick to filter in place // Use the following trick to filter in place
// https://github.com/golang/go/wiki/SliceTricks#filter-in-place // https://github.com/golang/go/wiki/SliceTricks#filter-in-place
for _, bucketInfo := range bucketsInfo { for _, bucketInfo := range bucketsInfo {
if globalIAMSys.IsAllowed(iampolicy.Args{ if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucketInfo.Name, BucketName: bucketInfo.Name,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
IsOwner: owner, IsOwner: owner,
@ -379,10 +378,10 @@ func (api objectAPIHandlers) ListBucketsHandler(w http.ResponseWriter, r *http.R
}) { }) {
bucketsInfo[n] = bucketInfo bucketsInfo[n] = bucketInfo
n++ n++
} else if globalIAMSys.IsAllowed(iampolicy.Args{ } else if globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.GetBucketLocationAction, Action: policy.GetBucketLocationAction,
BucketName: bucketInfo.Name, BucketName: bucketInfo.Name,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
IsOwner: owner, IsOwner: owner,
@ -770,8 +769,8 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
if objectLockEnabled { if objectLockEnabled {
// Creating a bucket with locking requires the user having more permissions // Creating a bucket with locking requires the user having more permissions
for _, action := range []iampolicy.Action{iampolicy.PutBucketObjectLockConfigurationAction, iampolicy.PutBucketVersioningAction} { for _, action := range []policy.Action{policy.PutBucketObjectLockConfigurationAction, policy.PutBucketVersioningAction} {
if !globalIAMSys.IsAllowed(iampolicy.Args{ if !globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: action, Action: action,
@ -1103,10 +1102,10 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h
if len(fanOutEntries) > 0 { if len(fanOutEntries) > 0 {
// Once signature is validated, check if the user has // Once signature is validated, check if the user has
// explicit permissions for the user. // explicit permissions for the user.
if !globalIAMSys.IsAllowed(iampolicy.Args{ if !globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.PutObjectFanOutAction, Action: policy.PutObjectFanOutAction,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
BucketName: bucket, BucketName: bucket,
ObjectName: object, ObjectName: object,
@ -1119,10 +1118,10 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h
} else { } else {
// Once signature is validated, check if the user has // Once signature is validated, check if the user has
// explicit permissions for the user. // explicit permissions for the user.
if !globalIAMSys.IsAllowed(iampolicy.Args{ if !globalIAMSys.IsAllowed(policy.Args{
AccountName: cred.AccessKey, AccountName: cred.AccessKey,
Groups: cred.Groups, Groups: cred.Groups,
Action: iampolicy.PutObjectAction, Action: policy.PutObjectAction,
ConditionValues: getConditionValues(r, "", cred), ConditionValues: getConditionValues(r, "", cred),
BucketName: bucket, BucketName: bucket,
ObjectName: object, ObjectName: object,
@ -1501,7 +1500,7 @@ func (api objectAPIHandlers) GetBucketPolicyStatusHandler(w http.ResponseWriter,
} }
// Check if anonymous (non-owner) has access to list objects. // Check if anonymous (non-owner) has access to list objects.
readable := globalPolicySys.IsAllowed(policy.Args{ readable := globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),
@ -1509,7 +1508,7 @@ func (api objectAPIHandlers) GetBucketPolicyStatusHandler(w http.ResponseWriter,
}) })
// Check if anonymous (non-owner) has access to upload objects. // Check if anonymous (non-owner) has access to upload objects.
writable := globalPolicySys.IsAllowed(policy.Args{ writable := globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.PutObjectAction, Action: policy.PutObjectAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),

View File

@ -27,7 +27,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
const ( const (

View File

@ -41,8 +41,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/s3select" "github.com/minio/minio/internal/s3select"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
"github.com/minio/pkg/workers" "github.com/minio/pkg/v2/workers"
) )
const ( const (

View File

@ -26,7 +26,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// Validate all the ListObjects query arguments, returns an APIErrorCode // Validate all the ListObjects query arguments, returns an APIErrorCode

View File

@ -35,8 +35,8 @@ import (
"github.com/minio/minio/internal/event" "github.com/minio/minio/internal/event"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
// BucketMetadataSys captures all bucket metadata for a given cluster. // BucketMetadataSys captures all bucket metadata for a given cluster.
@ -310,7 +310,7 @@ func (sys *BucketMetadataSys) CreatedAt(bucket string) (time.Time, error) {
// GetPolicyConfig returns configured bucket policy // GetPolicyConfig returns configured bucket policy
// The returned object may not be modified. // The returned object may not be modified.
func (sys *BucketMetadataSys) GetPolicyConfig(bucket string) (*policy.Policy, time.Time, error) { func (sys *BucketMetadataSys) GetPolicyConfig(bucket string) (*policy.BucketPolicy, time.Time, error) {
meta, _, err := sys.GetConfig(GlobalContext, bucket) meta, _, err := sys.GetConfig(GlobalContext, bucket)
if err != nil { if err != nil {
if errors.Is(err, errConfigNotFound) { if errors.Is(err, errConfigNotFound) {

View File

@ -41,7 +41,7 @@ import (
"github.com/minio/minio/internal/fips" "github.com/minio/minio/internal/fips"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
"github.com/minio/sio" "github.com/minio/sio"
) )
@ -91,7 +91,7 @@ type BucketMetadata struct {
LifecycleConfigUpdatedAt time.Time LifecycleConfigUpdatedAt time.Time
// Unexported fields. Must be updated atomically. // Unexported fields. Must be updated atomically.
policyConfig *policy.Policy policyConfig *policy.BucketPolicy
notificationConfig *event.Config notificationConfig *event.Config
lifecycleConfig *lifecycle.Lifecycle lifecycleConfig *lifecycle.Lifecycle
objectLockConfig *objectlock.Config objectLockConfig *objectlock.Config
@ -217,7 +217,7 @@ func loadBucketMetadata(ctx context.Context, objectAPI ObjectLayer, bucket strin
// The first error encountered is returned. // The first error encountered is returned.
func (b *BucketMetadata) parseAllConfigs(ctx context.Context, objectAPI ObjectLayer) (err error) { func (b *BucketMetadata) parseAllConfigs(ctx context.Context, objectAPI ObjectLayer) (err error) {
if len(b.PolicyConfigJSON) != 0 { if len(b.PolicyConfigJSON) != 0 {
b.policyConfig, err = policy.ParseConfig(bytes.NewReader(b.PolicyConfigJSON), b.Name) b.policyConfig, err = policy.ParseBucketPolicyConfig(bytes.NewReader(b.PolicyConfigJSON), b.Name)
if err != nil { if err != nil {
return err return err
} }

View File

@ -26,7 +26,7 @@ import (
"github.com/minio/minio/internal/event" "github.com/minio/minio/internal/event"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
const ( const (

View File

@ -28,7 +28,7 @@ import (
"github.com/minio/minio/internal/bucket/replication" "github.com/minio/minio/internal/bucket/replication"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// BucketObjectLockSys - map of bucket and retention configuration. // BucketObjectLockSys - map of bucket and retention configuration.

View File

@ -27,7 +27,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
const ( const (
@ -84,7 +84,7 @@ func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *ht
return return
} }
bucketPolicy, err := policy.ParseConfig(bytes.NewReader(bucketPolicyBytes), bucket) bucketPolicy, err := policy.ParseBucketPolicyConfig(bytes.NewReader(bucketPolicyBytes), bucket)
if err != nil { if err != nil {
writeErrorResponse(ctx, w, APIError{ writeErrorResponse(ctx, w, APIError{
Code: "MalformedPolicy", Code: "MalformedPolicy",

View File

@ -29,31 +29,31 @@ import (
"testing" "testing"
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
"github.com/minio/pkg/bucket/policy/condition" "github.com/minio/pkg/v2/policy/condition"
) )
func getAnonReadOnlyBucketPolicy(bucketName string) *policy.Policy { func getAnonReadOnlyBucketPolicy(bucketName string) *policy.BucketPolicy {
return &policy.Policy{ return &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement( policy.NewBPStatement(
"", "",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetBucketLocationAction, policy.ListBucketAction), policy.NewActionSet(policy.GetBucketLocationAction, policy.ListBucketAction),
policy.NewResourceSet(policy.NewResource(bucketName, "")), policy.NewResourceSet(policy.NewResource(bucketName)),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
} }
} }
func getAnonWriteOnlyBucketPolicy(bucketName string) *policy.Policy { func getAnonWriteOnlyBucketPolicy(bucketName string) *policy.BucketPolicy {
return &policy.Policy{ return &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement( policy.NewBPStatement(
"", "",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
@ -61,34 +61,34 @@ func getAnonWriteOnlyBucketPolicy(bucketName string) *policy.Policy {
policy.GetBucketLocationAction, policy.GetBucketLocationAction,
policy.ListBucketMultipartUploadsAction, policy.ListBucketMultipartUploadsAction,
), ),
policy.NewResourceSet(policy.NewResource(bucketName, "")), policy.NewResourceSet(policy.NewResource(bucketName)),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
} }
} }
func getAnonReadOnlyObjectPolicy(bucketName, prefix string) *policy.Policy { func getAnonReadOnlyObjectPolicy(bucketName, prefix string) *policy.BucketPolicy {
return &policy.Policy{ return &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement( policy.NewBPStatement(
"", "",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetObjectAction), policy.NewActionSet(policy.GetObjectAction),
policy.NewResourceSet(policy.NewResource(bucketName, prefix)), policy.NewResourceSet(policy.NewResource(bucketName+"/"+prefix)),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
} }
} }
func getAnonWriteOnlyObjectPolicy(bucketName, prefix string) *policy.Policy { func getAnonWriteOnlyObjectPolicy(bucketName, prefix string) *policy.BucketPolicy {
return &policy.Policy{ return &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement( policy.NewBPStatement(
"", "",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
@ -98,7 +98,7 @@ func getAnonWriteOnlyObjectPolicy(bucketName, prefix string) *policy.Policy {
policy.ListMultipartUploadPartsAction, policy.ListMultipartUploadPartsAction,
policy.PutObjectAction, policy.PutObjectAction,
), ),
policy.NewResourceSet(policy.NewResource(bucketName, prefix)), policy.NewResourceSet(policy.NewResource(bucketName+"/"+prefix)),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
@ -493,13 +493,13 @@ func testGetBucketPolicyHandler(obj ObjectLayer, instanceType, bucketName string
if recV4.Code != testCase.expectedRespStatus { if recV4.Code != testCase.expectedRespStatus {
// Verify whether the bucket policy fetched is same as the one inserted. // Verify whether the bucket policy fetched is same as the one inserted.
var expectedPolicy *policy.Policy var expectedPolicy *policy.BucketPolicy
expectedPolicy, err = policy.ParseConfig(strings.NewReader(expectedBucketPolicyStr), testCase.bucketName) expectedPolicy, err = policy.ParseBucketPolicyConfig(strings.NewReader(expectedBucketPolicyStr), testCase.bucketName)
if err != nil { if err != nil {
t.Fatalf("unexpected error. %v", err) t.Fatalf("unexpected error. %v", err)
} }
var gotPolicy *policy.Policy var gotPolicy *policy.BucketPolicy
gotPolicy, err = policy.ParseConfig(bytes.NewReader(bucketPolicyReadBuf), testCase.bucketName) gotPolicy, err = policy.ParseBucketPolicyConfig(bytes.NewReader(bucketPolicyReadBuf), testCase.bucketName)
if err != nil { if err != nil {
t.Fatalf("unexpected error. %v", err) t.Fatalf("unexpected error. %v", err)
} }
@ -530,11 +530,11 @@ func testGetBucketPolicyHandler(obj ObjectLayer, instanceType, bucketName string
} }
if recV2.Code == http.StatusOK { if recV2.Code == http.StatusOK {
// Verify whether the bucket policy fetched is same as the one inserted. // Verify whether the bucket policy fetched is same as the one inserted.
expectedPolicy, err := policy.ParseConfig(strings.NewReader(expectedBucketPolicyStr), testCase.bucketName) expectedPolicy, err := policy.ParseBucketPolicyConfig(strings.NewReader(expectedBucketPolicyStr), testCase.bucketName)
if err != nil { if err != nil {
t.Fatalf("unexpected error. %v", err) t.Fatalf("unexpected error. %v", err)
} }
gotPolicy, err := policy.ParseConfig(bytes.NewReader(bucketPolicyReadBuf), testCase.bucketName) gotPolicy, err := policy.ParseBucketPolicyConfig(bytes.NewReader(bucketPolicyReadBuf), testCase.bucketName)
if err != nil { if err != nil {
t.Fatalf("unexpected error. %v", err) t.Fatalf("unexpected error. %v", err)
} }

View File

@ -32,20 +32,20 @@ import (
"github.com/minio/minio/internal/handlers" "github.com/minio/minio/internal/handlers"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// PolicySys - policy subsystem. // PolicySys - policy subsystem.
type PolicySys struct{} type PolicySys struct{}
// Get returns stored bucket policy // Get returns stored bucket policy
func (sys *PolicySys) Get(bucket string) (*policy.Policy, error) { func (sys *PolicySys) Get(bucket string) (*policy.BucketPolicy, error) {
policy, _, err := globalBucketMetadataSys.GetPolicyConfig(bucket) policy, _, err := globalBucketMetadataSys.GetPolicyConfig(bucket)
return policy, err return policy, err
} }
// IsAllowed - checks given policy args is allowed to continue the Rest API. // IsAllowed - checks given policy args is allowed to continue the Rest API.
func (sys *PolicySys) IsAllowed(args policy.Args) bool { func (sys *PolicySys) IsAllowed(args policy.BucketPolicyArgs) bool {
p, err := sys.Get(args.BucketName) p, err := sys.Get(args.BucketName)
if err == nil { if err == nil {
return p.IsAllowed(args) return p.IsAllowed(args)
@ -236,7 +236,7 @@ func getConditionValues(r *http.Request, lc string, cred auth.Credentials) map[s
} }
// PolicyToBucketAccessPolicy converts a MinIO policy into a minio-go policy data structure. // PolicyToBucketAccessPolicy converts a MinIO policy into a minio-go policy data structure.
func PolicyToBucketAccessPolicy(bucketPolicy *policy.Policy) (*miniogopolicy.BucketAccessPolicy, error) { func PolicyToBucketAccessPolicy(bucketPolicy *policy.BucketPolicy) (*miniogopolicy.BucketAccessPolicy, error) {
// Return empty BucketAccessPolicy for empty bucket policy. // Return empty BucketAccessPolicy for empty bucket policy.
if bucketPolicy == nil { if bucketPolicy == nil {
return &miniogopolicy.BucketAccessPolicy{Version: policy.DefaultVersion}, nil return &miniogopolicy.BucketAccessPolicy{Version: policy.DefaultVersion}, nil
@ -258,15 +258,15 @@ func PolicyToBucketAccessPolicy(bucketPolicy *policy.Policy) (*miniogopolicy.Buc
return &policyInfo, nil return &policyInfo, nil
} }
// BucketAccessPolicyToPolicy - converts minio-go/policy.BucketAccessPolicy to policy.Policy. // BucketAccessPolicyToPolicy - converts minio-go/policy.BucketAccessPolicy to policy.BucketPolicy.
func BucketAccessPolicyToPolicy(policyInfo *miniogopolicy.BucketAccessPolicy) (*policy.Policy, error) { func BucketAccessPolicyToPolicy(policyInfo *miniogopolicy.BucketAccessPolicy) (*policy.BucketPolicy, error) {
data, err := json.Marshal(policyInfo) data, err := json.Marshal(policyInfo)
if err != nil { if err != nil {
// This should not happen because policyInfo is valid to convert to JSON data. // This should not happen because policyInfo is valid to convert to JSON data.
return nil, err return nil, err
} }
var bucketPolicy policy.Policy var bucketPolicy policy.BucketPolicy
json := jsoniter.ConfigCompatibleWithStandardLibrary json := jsoniter.ConfigCompatibleWithStandardLibrary
if err = json.Unmarshal(data, &bucketPolicy); err != nil { if err = json.Unmarshal(data, &bucketPolicy); err != nil {
// This should not happen because data is valid to JSON data. // This should not happen because data is valid to JSON data.

View File

@ -34,7 +34,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// PutBucketReplicationConfigHandler - PUT Bucket replication configuration. // PutBucketReplicationConfigHandler - PUT Bucket replication configuration.

View File

@ -28,7 +28,7 @@ import (
"github.com/minio/minio/internal/bucket/versioning" "github.com/minio/minio/internal/bucket/versioning"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
const ( const (

View File

@ -61,11 +61,11 @@ import (
"github.com/minio/minio/internal/config" "github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/certs" "github.com/minio/pkg/v2/certs"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
"github.com/minio/pkg/ellipses" "github.com/minio/pkg/v2/ellipses"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
// serverDebugLog will enable debug printing // serverDebugLog will enable debug printing

View File

@ -48,7 +48,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
func initHelp() { func initHelp() {

View File

@ -40,8 +40,8 @@ import (
"github.com/minio/minio/internal/event/target" "github.com/minio/minio/internal/event/target"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/logger/target/http" "github.com/minio/minio/internal/logger/target/http"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
"github.com/minio/pkg/quick" "github.com/minio/pkg/v2/quick"
) )
// Do not edit following message template, please open a GitHub issue to discuss instead. // Do not edit following message template, please open a GitHub issue to discuss instead.

View File

@ -31,7 +31,7 @@ import (
"github.com/minio/minio/internal/config/storageclass" "github.com/minio/minio/internal/config/storageclass"
"github.com/minio/minio/internal/event/target" "github.com/minio/minio/internal/event/target"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/quick" "github.com/minio/pkg/v2/quick"
) )
type configV1 struct { type configV1 struct {

View File

@ -28,8 +28,8 @@ import (
"github.com/minio/minio/internal/logger/target/console" "github.com/minio/minio/internal/logger/target/console"
"github.com/minio/minio/internal/logger/target/types" "github.com/minio/minio/internal/logger/target/types"
"github.com/minio/minio/internal/pubsub" "github.com/minio/minio/internal/pubsub"
"github.com/minio/pkg/logger/message/log" "github.com/minio/pkg/v2/logger/message/log"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
// number of log messages to buffer // number of log messages to buffer

View File

@ -41,7 +41,7 @@ import (
"github.com/minio/minio/internal/config/heal" "github.com/minio/minio/internal/config/heal"
"github.com/minio/minio/internal/event" "github.com/minio/minio/internal/event"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
uatomic "go.uber.org/atomic" uatomic "go.uber.org/atomic"
) )

View File

@ -33,9 +33,9 @@ import (
"github.com/minio/minio/internal/disk" "github.com/minio/minio/internal/disk"
"github.com/minio/minio/internal/hash" "github.com/minio/minio/internal/hash"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
) )
const ( const (

View File

@ -22,7 +22,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// Data types used for returning dummy tagging XML. // Data types used for returning dummy tagging XML.

View File

@ -26,8 +26,8 @@ import (
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/internal/config" "github.com/minio/minio/internal/config"
"github.com/minio/pkg/ellipses" "github.com/minio/pkg/v2/ellipses"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
// This file implements and supports ellipses pattern for // This file implements and supports ellipses pattern for

View File

@ -22,7 +22,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/minio/pkg/ellipses" "github.com/minio/pkg/v2/ellipses"
) )
// Tests create endpoints with ellipses and without. // Tests create endpoints with ellipses and without.

View File

@ -36,8 +36,8 @@ import (
"github.com/minio/minio/internal/config" "github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/mountinfo" "github.com/minio/minio/internal/mountinfo"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )

View File

@ -26,7 +26,7 @@ import (
"time" "time"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
func (er erasureObjects) getOnlineDisks() (newDisks []StorageAPI) { func (er erasureObjects) getOnlineDisks() (newDisks []StorageAPI) {

View File

@ -29,7 +29,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
const reservedMetadataPrefixLowerDataShardFix = ReservedMetadataPrefixLower + "data-shard-fix" const reservedMetadataPrefixLowerDataShardFix = ReservedMetadataPrefixLower + "data-shard-fix"

View File

@ -25,7 +25,7 @@ import (
"io" "io"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
// figure out the most commonVersions across disk that satisfies // figure out the most commonVersions across disk that satisfies

View File

@ -32,7 +32,7 @@ import (
"github.com/minio/minio/internal/hash/sha256" "github.com/minio/minio/internal/hash/sha256"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
"github.com/minio/sio" "github.com/minio/sio"
) )

View File

@ -38,8 +38,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
xioutil "github.com/minio/minio/internal/ioutil" xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/mimedb" "github.com/minio/pkg/v2/mimedb"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
uatomic "go.uber.org/atomic" uatomic "go.uber.org/atomic"
) )

View File

@ -43,9 +43,9 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
xioutil "github.com/minio/minio/internal/ioutil" xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/mimedb" "github.com/minio/pkg/v2/mimedb"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
uatomic "go.uber.org/atomic" uatomic "go.uber.org/atomic"
) )

View File

@ -34,9 +34,9 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/hash" "github.com/minio/minio/internal/hash"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
"github.com/minio/pkg/workers" "github.com/minio/pkg/v2/workers"
) )
// PoolDecommissionInfo currently decommissioning information // PoolDecommissionInfo currently decommissioning information

View File

@ -35,7 +35,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/hash" "github.com/minio/minio/internal/hash"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
//go:generate msgp -file $GOFILE -unexported //go:generate msgp -file $GOFILE -unexported

View File

@ -39,8 +39,8 @@ import (
"github.com/minio/minio-go/v7/pkg/tags" "github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/internal/config/storageclass" "github.com/minio/minio/internal/config/storageclass"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
) )
type erasureServerPools struct { type erasureServerPools struct {

View File

@ -39,8 +39,8 @@ import (
"github.com/minio/minio/internal/bpool" "github.com/minio/minio/internal/bpool"
"github.com/minio/minio/internal/dsync" "github.com/minio/minio/internal/dsync"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
// setsDsyncLockers is encapsulated type for Close() // setsDsyncLockers is encapsulated type for Close()

View File

@ -33,7 +33,7 @@ import (
"github.com/minio/minio/internal/dsync" "github.com/minio/minio/internal/dsync"
xioutil "github.com/minio/minio/internal/ioutil" xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
// list all errors that can be ignore in a bucket operation. // list all errors that can be ignore in a bucket operation.

View File

@ -29,7 +29,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/pubsub" "github.com/minio/minio/internal/pubsub"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// EventNotifier - notifies external systems about events in MinIO. // EventNotifier - notifies external systems about events in MinIO.

View File

@ -33,7 +33,7 @@ import (
"github.com/minio/minio/internal/config/storageclass" "github.com/minio/minio/internal/config/storageclass"
xioutil "github.com/minio/minio/internal/ioutil" xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
const ( const (

View File

@ -31,7 +31,7 @@ import (
"github.com/dustin/go-humanize" "github.com/dustin/go-humanize"
"github.com/minio/minio-go/v7/pkg/s3utils" "github.com/minio/minio-go/v7/pkg/s3utils"
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
"github.com/minio/minio/internal/amztime" "github.com/minio/minio/internal/amztime"
"github.com/minio/minio/internal/config/dns" "github.com/minio/minio/internal/config/dns"

View File

@ -28,8 +28,8 @@ import (
"github.com/minio/minio/internal/color" "github.com/minio/minio/internal/color"
"github.com/minio/minio/internal/config/storageclass" "github.com/minio/minio/internal/config/storageclass"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
) )
const ( const (

View File

@ -52,8 +52,8 @@ import (
levent "github.com/minio/minio/internal/config/lambda/event" levent "github.com/minio/minio/internal/config/lambda/event"
"github.com/minio/minio/internal/event" "github.com/minio/minio/internal/event"
"github.com/minio/minio/internal/pubsub" "github.com/minio/minio/internal/pubsub"
"github.com/minio/pkg/certs" "github.com/minio/pkg/v2/certs"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
// minio configuration related constants. // minio configuration related constants.

View File

@ -32,7 +32,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/mcontext" "github.com/minio/minio/internal/mcontext"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
const ( const (

View File

@ -34,7 +34,7 @@ import (
"github.com/minio/minio/internal/config/identity/openid" "github.com/minio/minio/internal/config/identity/openid"
"github.com/minio/minio/internal/jwt" "github.com/minio/minio/internal/jwt"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
const ( const (
@ -1157,7 +1157,7 @@ func (store *IAMStoreSys) GetPolicy(name string) (iampolicy.Policy, error) {
defer store.runlock() defer store.runlock()
policies := newMappedPolicy(name).toSlice() policies := newMappedPolicy(name).toSlice()
var combinedPolicy iampolicy.Policy var toMerge []iampolicy.Policy
for _, policy := range policies { for _, policy := range policies {
if policy == "" { if policy == "" {
continue continue
@ -1166,9 +1166,9 @@ func (store *IAMStoreSys) GetPolicy(name string) (iampolicy.Policy, error) {
if !ok { if !ok {
return v.Policy, errNoSuchPolicy return v.Policy, errNoSuchPolicy
} }
combinedPolicy = combinedPolicy.Merge(v.Policy) toMerge = append(toMerge, v.Policy)
} }
return combinedPolicy, nil return iampolicy.MergePolicies(toMerge...), nil
} }
// GetPolicyDoc - gets the policy doc which has the policy and some metadata. // GetPolicyDoc - gets the policy doc which has the policy and some metadata.
@ -1292,7 +1292,7 @@ func (store *IAMStoreSys) listPolicyDocs(ctx context.Context, bucketName string)
func filterPolicies(cache *iamCache, policyName string, bucketName string) (string, iampolicy.Policy) { func filterPolicies(cache *iamCache, policyName string, bucketName string) (string, iampolicy.Policy) {
var policies []string var policies []string
mp := newMappedPolicy(policyName) mp := newMappedPolicy(policyName)
combinedPolicy := iampolicy.Policy{} var toMerge []iampolicy.Policy
for _, policy := range mp.toSlice() { for _, policy := range mp.toSlice() {
if policy == "" { if policy == "" {
continue continue
@ -1303,10 +1303,10 @@ func filterPolicies(cache *iamCache, policyName string, bucketName string) (stri
} }
if bucketName == "" || p.Policy.MatchResource(bucketName) { if bucketName == "" || p.Policy.MatchResource(bucketName) {
policies = append(policies, policy) policies = append(policies, policy)
combinedPolicy = combinedPolicy.Merge(p.Policy) toMerge = append(toMerge, p.Policy)
} }
} }
return strings.Join(policies, ","), combinedPolicy return strings.Join(policies, ","), iampolicy.MergePolicies(toMerge...)
} }
// FilterPolicies - accepts a comma separated list of policy names as a string // FilterPolicies - accepts a comma separated list of policy names as a string

View File

@ -47,7 +47,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/jwt" "github.com/minio/minio/internal/jwt"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
etcd "go.etcd.io/etcd/client/v3" etcd "go.etcd.io/etcd/client/v3"
) )

View File

@ -28,7 +28,7 @@ import (
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
xjwt "github.com/minio/minio/internal/jwt" xjwt "github.com/minio/minio/internal/jwt"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
const ( const (

View File

@ -29,7 +29,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/kms" "github.com/minio/minio/internal/kms"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
) )
// KMSStatusHandler - GET /minio/kms/v1/status // KMSStatusHandler - GET /minio/kms/v1/status

View File

@ -27,7 +27,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/pubsub" "github.com/minio/minio/internal/pubsub"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
func (api objectAPIHandlers) ListenNotificationHandler(w http.ResponseWriter, r *http.Request) { func (api objectAPIHandlers) ListenNotificationHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -30,10 +30,10 @@ import (
"github.com/minio/cli" "github.com/minio/cli"
"github.com/minio/minio/internal/color" "github.com/minio/minio/internal/color"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
"github.com/minio/pkg/trie" "github.com/minio/pkg/v2/trie"
"github.com/minio/pkg/words" "github.com/minio/pkg/v2/words"
) )
// GlobalFlags - global flags for minio. // GlobalFlags - global flags for minio.

View File

@ -26,7 +26,7 @@ import (
"time" "time"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
) )
// a bucketMetacache keeps track of all caches generated // a bucketMetacache keeps track of all caches generated

View File

@ -27,7 +27,7 @@ import (
"strings" "strings"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
) )
// metaCacheEntry is an object or a directory within an unknown bucket. // metaCacheEntry is an object or a directory within an unknown bucket.

View File

@ -38,7 +38,7 @@ import (
"github.com/minio/minio/internal/color" "github.com/minio/minio/internal/color"
"github.com/minio/minio/internal/hash" "github.com/minio/minio/internal/hash"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/console" "github.com/minio/pkg/v2/console"
) )
type listPathOptions struct { type listPathOptions struct {

View File

@ -21,7 +21,7 @@ import (
"strings" "strings"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
) )
const ( const (

View File

@ -25,7 +25,7 @@ import (
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/mcontext" "github.com/minio/minio/internal/mcontext"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/expfmt" "github.com/prometheus/common/expfmt"
) )

View File

@ -29,7 +29,7 @@ import (
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/internal/config" "github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
// IPv4 addresses of local host. // IPv4 addresses of local host.

View File

@ -33,8 +33,8 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio/internal/bucket/bandwidth" "github.com/minio/minio/internal/bucket/bandwidth"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
// This file contains peer related notifications. For sending notifications to // This file contains peer related notifications. For sending notifications to

View File

@ -47,8 +47,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/ioutil" "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/trie" "github.com/minio/pkg/v2/trie"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
"github.com/valyala/bytebufferpool" "github.com/valyala/bytebufferpool"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )

View File

@ -34,7 +34,7 @@ import (
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
"github.com/minio/minio/internal/config/compress" "github.com/minio/minio/internal/config/compress"
"github.com/minio/minio/internal/crypto" "github.com/minio/minio/internal/crypto"
"github.com/minio/pkg/trie" "github.com/minio/pkg/v2/trie"
) )
func pathJoinOld(elem ...string) string { func pathJoinOld(elem ...string) string {

View File

@ -59,9 +59,8 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/s3select" "github.com/minio/minio/internal/s3select"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" xnet "github.com/minio/pkg/v2/net"
iampolicy "github.com/minio/pkg/iam/policy" "github.com/minio/pkg/v2/policy"
xnet "github.com/minio/pkg/net"
) )
// supportedHeadGetReqParams - supported request parameters for GET and HEAD presigned request. // supportedHeadGetReqParams - supported request parameters for GET and HEAD presigned request.
@ -154,7 +153,7 @@ func (api objectAPIHandlers) SelectObjectContentHandler(w http.ResponseWriter, r
// * if you dont have the s3:ListBucket // * if you dont have the s3:ListBucket
// permission, Amazon S3 will return an HTTP // permission, Amazon S3 will return an HTTP
// status code 403 ("access denied") error.` // status code 403 ("access denied") error.`
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),
@ -344,7 +343,7 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj
// * if you dont have the s3:ListBucket // * if you dont have the s3:ListBucket
// permission, Amazon S3 will return an HTTP // permission, Amazon S3 will return an HTTP
// status code 403 ("access denied") error.` // status code 403 ("access denied") error.`
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),
@ -643,7 +642,7 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
// * if you dont have the s3:ListBucket // * if you dont have the s3:ListBucket
// permission, Amazon S3 will return an HTTP // permission, Amazon S3 will return an HTTP
// status code 403 ("access denied") error.` // status code 403 ("access denied") error.`
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),
@ -1374,8 +1373,8 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
srcInfo.UserDefined = filterReplicationStatusMetadata(srcInfo.UserDefined) srcInfo.UserDefined = filterReplicationStatusMetadata(srcInfo.UserDefined)
srcInfo.UserDefined = objectlock.FilterObjectLockMetadata(srcInfo.UserDefined, true, true) srcInfo.UserDefined = objectlock.FilterObjectLockMetadata(srcInfo.UserDefined, true, true)
retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), dstBucket, dstObject, r, iampolicy.PutObjectRetentionAction) retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), dstBucket, dstObject, r, policy.PutObjectRetentionAction)
holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), dstBucket, dstObject, r, iampolicy.PutObjectLegalHoldAction) holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), dstBucket, dstObject, r, policy.PutObjectLegalHoldAction)
getObjectInfo := objectAPI.GetObjectInfo getObjectInfo := objectAPI.GetObjectInfo
if api.CacheAPI() != nil { if api.CacheAPI() != nil {
getObjectInfo = api.CacheAPI().GetObjectInfo getObjectInfo = api.CacheAPI().GetObjectInfo
@ -1668,7 +1667,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
) )
// Check if put is allowed // Check if put is allowed
if s3Err = isPutActionAllowed(ctx, rAuthType, bucket, object, r, iampolicy.PutObjectAction); s3Err != ErrNone { if s3Err = isPutActionAllowed(ctx, rAuthType, bucket, object, r, policy.PutObjectAction); s3Err != ErrNone {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL) writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL)
return return
} }
@ -1716,7 +1715,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
return return
} }
if r.Header.Get(xhttp.AmzBucketReplicationStatus) == replication.Replica.String() { if r.Header.Get(xhttp.AmzBucketReplicationStatus) == replication.Replica.String() {
if s3Err = isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.ReplicateObjectAction); s3Err != ErrNone { if s3Err = isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.ReplicateObjectAction); s3Err != ErrNone {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL) writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL)
return return
} }
@ -1796,8 +1795,8 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
putObject = api.CacheAPI().PutObject putObject = api.CacheAPI().PutObject
} }
retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectRetentionAction) retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectRetentionAction)
holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectLegalHoldAction) holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectLegalHoldAction)
getObjectInfo := objectAPI.GetObjectInfo getObjectInfo := objectAPI.GetObjectInfo
if api.CacheAPI() != nil { if api.CacheAPI() != nil {
@ -2046,7 +2045,7 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h
) )
// Check if put is allowed // Check if put is allowed
if s3Err = isPutActionAllowed(ctx, rAuthType, bucket, object, r, iampolicy.PutObjectAction); s3Err != ErrNone { if s3Err = isPutActionAllowed(ctx, rAuthType, bucket, object, r, policy.PutObjectAction); s3Err != ErrNone {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL) writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL)
return return
} }
@ -2097,8 +2096,8 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h
AutoEncrypt: globalAutoEncryption, AutoEncrypt: globalAutoEncryption,
}) })
retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectRetentionAction) retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectRetentionAction)
holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectLegalHoldAction) holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectLegalHoldAction)
if api.CacheAPI() != nil { if api.CacheAPI() != nil {
putObject = api.CacheAPI().PutObject putObject = api.CacheAPI().PutObject
@ -2150,7 +2149,7 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h
pReader := NewPutObjReader(rawReader) pReader := NewPutObjReader(rawReader)
if r.Header.Get(xhttp.AmzBucketReplicationStatus) == replication.Replica.String() { if r.Header.Get(xhttp.AmzBucketReplicationStatus) == replication.Replica.String() {
if s3Err = isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.ReplicateObjectAction); s3Err != ErrNone { if s3Err = isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.ReplicateObjectAction); s3Err != ErrNone {
return err return err
} }
metadata[ReservedMetadataPrefixLower+ReplicaStatus] = replication.Replica.String() metadata[ReservedMetadataPrefixLower+ReplicaStatus] = replication.Replica.String()

View File

@ -29,7 +29,7 @@ import (
miniogo "github.com/minio/minio-go/v7" miniogo "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
levent "github.com/minio/minio/internal/config/lambda/event" levent "github.com/minio/minio/internal/config/lambda/event"

View File

@ -46,8 +46,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
iampolicy "github.com/minio/pkg/iam/policy"
"github.com/minio/sio" "github.com/minio/sio"
) )
@ -145,8 +144,8 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r
metadata[xhttp.AmzObjectTagging] = objTags metadata[xhttp.AmzObjectTagging] = objTags
} }
retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectRetentionAction) retPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectRetentionAction)
holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectLegalHoldAction) holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, policy.PutObjectLegalHoldAction)
getObjectInfo := objectAPI.GetObjectInfo getObjectInfo := objectAPI.GetObjectInfo
if api.CacheAPI() != nil { if api.CacheAPI() != nil {
@ -655,7 +654,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
reader io.Reader = r.Body reader io.Reader = r.Body
s3Error APIErrorCode s3Error APIErrorCode
) )
if s3Error = isPutActionAllowed(ctx, rAuthType, bucket, object, r, iampolicy.PutObjectAction); s3Error != ErrNone { if s3Error = isPutActionAllowed(ctx, rAuthType, bucket, object, r, policy.PutObjectAction); s3Error != ErrNone {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL) writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
return return
} }

View File

@ -35,8 +35,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/rest" "github.com/minio/minio/internal/rest"
"github.com/minio/pkg/logger/message/log" "github.com/minio/pkg/v2/logger/message/log"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
"github.com/tinylib/msgp/msgp" "github.com/tinylib/msgp/msgp"
) )

View File

@ -36,7 +36,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/pubsub" "github.com/minio/minio/internal/pubsub"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/logger/message/log" "github.com/minio/pkg/v2/logger/message/log"
"github.com/tinylib/msgp/msgp" "github.com/tinylib/msgp/msgp"
) )

View File

@ -27,7 +27,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/rest" "github.com/minio/minio/internal/rest"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )

View File

@ -26,7 +26,7 @@ import (
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
"github.com/minio/pkg/sync/errgroup" "github.com/minio/pkg/v2/sync/errgroup"
) )
const ( const (

View File

@ -34,7 +34,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/pkg/randreader" "github.com/minio/pkg/v2/randreader"
) )
// SpeedTestResult return value of the speedtest function // SpeedTestResult return value of the speedtest function

View File

@ -23,39 +23,39 @@ import (
miniogopolicy "github.com/minio/minio-go/v7/pkg/policy" miniogopolicy "github.com/minio/minio-go/v7/pkg/policy"
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
"github.com/minio/pkg/bucket/policy/condition" "github.com/minio/pkg/v2/policy/condition"
) )
func TestPolicySysIsAllowed(t *testing.T) { func TestPolicySysIsAllowed(t *testing.T) {
p := &policy.Policy{ p := &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetBucketLocationAction), policy.NewActionSet(policy.GetBucketLocationAction),
policy.NewResourceSet(policy.NewResource("mybucket", "")), policy.NewResourceSet(policy.NewResource("mybucket")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.PutObjectAction), policy.NewActionSet(policy.PutObjectAction),
policy.NewResourceSet(policy.NewResource("mybucket", "/myobject*")), policy.NewResourceSet(policy.NewResource("mybucket/myobject*")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
} }
anonGetBucketLocationArgs := policy.Args{ anonGetBucketLocationArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.GetBucketLocationAction, Action: policy.GetBucketLocationAction,
BucketName: "mybucket", BucketName: "mybucket",
ConditionValues: map[string][]string{}, ConditionValues: map[string][]string{},
} }
anonPutObjectActionArgs := policy.Args{ anonPutObjectActionArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.PutObjectAction, Action: policy.PutObjectAction,
BucketName: "mybucket", BucketName: "mybucket",
@ -66,7 +66,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
ObjectName: "myobject", ObjectName: "myobject",
} }
anonGetObjectActionArgs := policy.Args{ anonGetObjectActionArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.GetObjectAction, Action: policy.GetObjectAction,
BucketName: "mybucket", BucketName: "mybucket",
@ -74,7 +74,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
ObjectName: "myobject", ObjectName: "myobject",
} }
getBucketLocationArgs := policy.Args{ getBucketLocationArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.GetBucketLocationAction, Action: policy.GetBucketLocationAction,
BucketName: "mybucket", BucketName: "mybucket",
@ -82,7 +82,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
IsOwner: true, IsOwner: true,
} }
putObjectActionArgs := policy.Args{ putObjectActionArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.PutObjectAction, Action: policy.PutObjectAction,
BucketName: "mybucket", BucketName: "mybucket",
@ -94,7 +94,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
ObjectName: "myobject", ObjectName: "myobject",
} }
getObjectActionArgs := policy.Args{ getObjectActionArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.GetObjectAction, Action: policy.GetObjectAction,
BucketName: "mybucket", BucketName: "mybucket",
@ -103,7 +103,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
ObjectName: "myobject", ObjectName: "myobject",
} }
yourbucketAnonGetObjectActionArgs := policy.Args{ yourbucketAnonGetObjectActionArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.GetObjectAction, Action: policy.GetObjectAction,
BucketName: "yourbucket", BucketName: "yourbucket",
@ -111,7 +111,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
ObjectName: "yourobject", ObjectName: "yourobject",
} }
yourbucketGetObjectActionArgs := policy.Args{ yourbucketGetObjectActionArgs := policy.BucketPolicyArgs{
AccountName: "Q3AM3UQ867SPQQA43P2F", AccountName: "Q3AM3UQ867SPQQA43P2F",
Action: policy.GetObjectAction, Action: policy.GetObjectAction,
BucketName: "yourbucket", BucketName: "yourbucket",
@ -121,7 +121,7 @@ func TestPolicySysIsAllowed(t *testing.T) {
} }
testCases := []struct { testCases := []struct {
args policy.Args args policy.BucketPolicyArgs
expectedResult bool expectedResult bool
}{ }{
{anonGetBucketLocationArgs, true}, {anonGetBucketLocationArgs, true},
@ -148,34 +148,34 @@ func getReadOnlyStatement(bucketName, prefix string) []miniogopolicy.Statement {
{ {
Effect: string(policy.Allow), Effect: string(policy.Allow),
Principal: miniogopolicy.User{AWS: set.CreateStringSet("*")}, Principal: miniogopolicy.User{AWS: set.CreateStringSet("*")},
Resources: set.CreateStringSet(policy.NewResource(bucketName, "").String()), Resources: set.CreateStringSet(policy.NewResource(bucketName).String()),
Actions: set.CreateStringSet("s3:GetBucketLocation", "s3:ListBucket"), Actions: set.CreateStringSet("s3:GetBucketLocation", "s3:ListBucket"),
}, },
{ {
Effect: string(policy.Allow), Effect: string(policy.Allow),
Principal: miniogopolicy.User{AWS: set.CreateStringSet("*")}, Principal: miniogopolicy.User{AWS: set.CreateStringSet("*")},
Resources: set.CreateStringSet(policy.NewResource(bucketName, prefix).String()), Resources: set.CreateStringSet(policy.NewResource(bucketName + "/" + prefix).String()),
Actions: set.CreateStringSet("s3:GetObject"), Actions: set.CreateStringSet("s3:GetObject"),
}, },
} }
} }
func TestPolicyToBucketAccessPolicy(t *testing.T) { func TestPolicyToBucketAccessPolicy(t *testing.T) {
case1Policy := &policy.Policy{ case1Policy := &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetBucketLocationAction, policy.ListBucketAction), policy.NewActionSet(policy.GetBucketLocationAction, policy.ListBucketAction),
policy.NewResourceSet(policy.NewResource("mybucket", "")), policy.NewResourceSet(policy.NewResource("mybucket")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetObjectAction), policy.NewActionSet(policy.GetObjectAction),
policy.NewResourceSet(policy.NewResource("mybucket", "/myobject*")), policy.NewResourceSet(policy.NewResource("mybucket/myobject*")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
@ -183,12 +183,12 @@ func TestPolicyToBucketAccessPolicy(t *testing.T) {
case1Result := &miniogopolicy.BucketAccessPolicy{ case1Result := &miniogopolicy.BucketAccessPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: getReadOnlyStatement("mybucket", "/myobject*"), Statements: getReadOnlyStatement("mybucket", "myobject*"),
} }
case2Policy := &policy.Policy{ case2Policy := &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{}, Statements: []policy.BPStatement{},
} }
case2Result := &miniogopolicy.BucketAccessPolicy{ case2Result := &miniogopolicy.BucketAccessPolicy{
@ -196,21 +196,21 @@ func TestPolicyToBucketAccessPolicy(t *testing.T) {
Statements: []miniogopolicy.Statement{}, Statements: []miniogopolicy.Statement{},
} }
case3Policy := &policy.Policy{ case3Policy := &policy.BucketPolicy{
Version: "12-10-2012", Version: "12-10-2012",
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.PutObjectAction), policy.NewActionSet(policy.PutObjectAction),
policy.NewResourceSet(policy.NewResource("mybucket", "/myobject*")), policy.NewResourceSet(policy.NewResource("mybucket/myobject*")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
} }
testCases := []struct { testCases := []struct {
bucketPolicy *policy.Policy bucketPolicy *policy.BucketPolicy
expectedResult *miniogopolicy.BucketAccessPolicy expectedResult *miniogopolicy.BucketAccessPolicy
expectErr bool expectErr bool
}{ }{
@ -238,24 +238,24 @@ func TestPolicyToBucketAccessPolicy(t *testing.T) {
func TestBucketAccessPolicyToPolicy(t *testing.T) { func TestBucketAccessPolicyToPolicy(t *testing.T) {
case1PolicyInfo := &miniogopolicy.BucketAccessPolicy{ case1PolicyInfo := &miniogopolicy.BucketAccessPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: getReadOnlyStatement("mybucket", "/myobject*"), Statements: getReadOnlyStatement("mybucket", "myobject*"),
} }
case1Result := &policy.Policy{ case1Result := &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{ Statements: []policy.BPStatement{
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetBucketLocationAction, policy.ListBucketAction), policy.NewActionSet(policy.GetBucketLocationAction, policy.ListBucketAction),
policy.NewResourceSet(policy.NewResource("mybucket", "")), policy.NewResourceSet(policy.NewResource("mybucket")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
policy.NewStatement("", policy.NewBPStatement("",
policy.Allow, policy.Allow,
policy.NewPrincipal("*"), policy.NewPrincipal("*"),
policy.NewActionSet(policy.GetObjectAction), policy.NewActionSet(policy.GetObjectAction),
policy.NewResourceSet(policy.NewResource("mybucket", "/myobject*")), policy.NewResourceSet(policy.NewResource("mybucket/myobject*")),
condition.NewFunctions(), condition.NewFunctions(),
), ),
}, },
@ -266,9 +266,9 @@ func TestBucketAccessPolicyToPolicy(t *testing.T) {
Statements: []miniogopolicy.Statement{}, Statements: []miniogopolicy.Statement{},
} }
case2Result := &policy.Policy{ case2Result := &policy.BucketPolicy{
Version: policy.DefaultVersion, Version: policy.DefaultVersion,
Statements: []policy.Statement{}, Statements: []policy.BPStatement{},
} }
case3PolicyInfo := &miniogopolicy.BucketAccessPolicy{ case3PolicyInfo := &miniogopolicy.BucketAccessPolicy{
@ -278,7 +278,7 @@ func TestBucketAccessPolicyToPolicy(t *testing.T) {
testCases := []struct { testCases := []struct {
policyInfo *miniogopolicy.BucketAccessPolicy policyInfo *miniogopolicy.BucketAccessPolicy
expectedResult *policy.Policy expectedResult *policy.BucketPolicy
expectErr bool expectErr bool
}{ }{
{case1PolicyInfo, case1Result, false}, {case1PolicyInfo, case1Result, false},

View File

@ -32,8 +32,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
xioutil "github.com/minio/minio/internal/ioutil" xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy" xnet "github.com/minio/pkg/v2/net"
xnet "github.com/minio/pkg/net" "github.com/minio/pkg/v2/policy"
"github.com/minio/zipindex" "github.com/minio/zipindex"
) )
@ -103,7 +103,7 @@ func (api objectAPIHandlers) getObjectInArchiveFileHandler(ctx context.Context,
// * if you dont have the s3:ListBucket // * if you dont have the s3:ListBucket
// permission, Amazon S3 will return an HTTP // permission, Amazon S3 will return an HTTP
// status code 403 ("access denied") error.` // status code 403 ("access denied") error.`
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),
@ -409,7 +409,7 @@ func (api objectAPIHandlers) headObjectInArchiveFileHandler(ctx context.Context,
// * if you dont have the s3:ListBucket // * if you dont have the s3:ListBucket
// permission, Amazon S3 will return an HTTP // permission, Amazon S3 will return an HTTP
// status code 403 ("access denied") error.` // status code 403 ("access denied") error.`
if globalPolicySys.IsAllowed(policy.Args{ if globalPolicySys.IsAllowed(policy.BucketPolicyArgs{
Action: policy.ListBucketAction, Action: policy.ListBucketAction,
BucketName: bucket, BucketName: bucket,
ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials), ConditionValues: getConditionValues(r, "", auth.AnonymousCredentials),

View File

@ -48,8 +48,8 @@ import (
"github.com/minio/minio/internal/hash/sha256" "github.com/minio/minio/internal/hash/sha256"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/certs" "github.com/minio/pkg/v2/certs"
"github.com/minio/pkg/env" "github.com/minio/pkg/v2/env"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )

View File

@ -23,7 +23,7 @@ import (
"github.com/minio/madmin-go/v3/kernel" "github.com/minio/madmin-go/v3/kernel"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sys" "github.com/minio/pkg/v2/sys"
) )
func oldLinux() bool { func oldLinux() bool {

View File

@ -28,7 +28,7 @@ import (
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
color "github.com/minio/minio/internal/color" color "github.com/minio/minio/internal/color"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
// generates format string depending on the string length and padding. // generates format string depending on the string length and padding.

View File

@ -37,7 +37,7 @@ import (
"github.com/dustin/go-humanize" "github.com/dustin/go-humanize"
"github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio-go/v7/pkg/set"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
) )
// API suite container common to both ErasureSD and Erasure. // API suite container common to both ErasureSD and Erasure.
@ -390,9 +390,9 @@ func (s *TestSuiteCommon) TestBucketPolicy(c *check) {
bucketPolicyReadBuf, err := io.ReadAll(response.Body) bucketPolicyReadBuf, err := io.ReadAll(response.Body)
c.Assert(err, nil) c.Assert(err, nil)
// Verify if downloaded policy matches with previously uploaded. // Verify if downloaded policy matches with previously uploaded.
expectedPolicy, err := policy.ParseConfig(strings.NewReader(bucketPolicyStr), bucketName) expectedPolicy, err := policy.ParseBucketPolicyConfig(strings.NewReader(bucketPolicyStr), bucketName)
c.Assert(err, nil) c.Assert(err, nil)
gotPolicy, err := policy.ParseConfig(bytes.NewReader(bucketPolicyReadBuf), bucketName) gotPolicy, err := policy.ParseBucketPolicyConfig(bytes.NewReader(bucketPolicyReadBuf), bucketName)
c.Assert(err, nil) c.Assert(err, nil)
c.Assert(reflect.DeepEqual(expectedPolicy, gotPolicy), true) c.Assert(reflect.DeepEqual(expectedPolicy, gotPolicy), true)

View File

@ -30,7 +30,7 @@ import (
"github.com/minio/minio/internal/hash/sha256" "github.com/minio/minio/internal/hash/sha256"
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )

View File

@ -42,8 +42,7 @@ import (
"github.com/minio/minio/internal/auth" "github.com/minio/minio/internal/auth"
sreplication "github.com/minio/minio/internal/bucket/replication" sreplication "github.com/minio/minio/internal/bucket/replication"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
bktpolicy "github.com/minio/pkg/bucket/policy" "github.com/minio/pkg/v2/policy"
iampolicy "github.com/minio/pkg/iam/policy"
) )
const ( const (
@ -1168,7 +1167,7 @@ func (c *SiteReplicationSys) IAMChangeHook(ctx context.Context, item madmin.SRIA
// PeerAddPolicyHandler - copies IAM policy to local. A nil policy argument, // PeerAddPolicyHandler - copies IAM policy to local. A nil policy argument,
// causes the named policy to be deleted. // causes the named policy to be deleted.
func (c *SiteReplicationSys) PeerAddPolicyHandler(ctx context.Context, policyName string, p *iampolicy.Policy, updatedAt time.Time) error { func (c *SiteReplicationSys) PeerAddPolicyHandler(ctx context.Context, policyName string, p *policy.Policy, updatedAt time.Time) error {
var err error var err error
// skip overwrite of local update if peer sent stale info // skip overwrite of local update if peer sent stale info
if !updatedAt.IsZero() { if !updatedAt.IsZero() {
@ -1261,10 +1260,10 @@ func (c *SiteReplicationSys) PeerSvcAccChangeHandler(ctx context.Context, change
} }
switch { switch {
case change.Create != nil: case change.Create != nil:
var sp *iampolicy.Policy var sp *policy.Policy
var err error var err error
if len(change.Create.SessionPolicy) > 0 { if len(change.Create.SessionPolicy) > 0 {
sp, err = iampolicy.ParseConfig(bytes.NewReader(change.Create.SessionPolicy)) sp, err = policy.ParseConfig(bytes.NewReader(change.Create.SessionPolicy))
if err != nil { if err != nil {
return wrapSRErr(err) return wrapSRErr(err)
} }
@ -1290,10 +1289,10 @@ func (c *SiteReplicationSys) PeerSvcAccChangeHandler(ctx context.Context, change
} }
case change.Update != nil: case change.Update != nil:
var sp *iampolicy.Policy var sp *policy.Policy
var err error var err error
if len(change.Update.SessionPolicy) > 0 { if len(change.Update.SessionPolicy) > 0 {
sp, err = iampolicy.ParseConfig(bytes.NewReader(change.Update.SessionPolicy)) sp, err = policy.ParseConfig(bytes.NewReader(change.Update.SessionPolicy))
if err != nil { if err != nil {
return wrapSRErr(err) return wrapSRErr(err)
} }
@ -1527,7 +1526,7 @@ func (c *SiteReplicationSys) PeerBucketMetadataUpdateHandler(ctx context.Context
} }
// PeerBucketPolicyHandler - copies/deletes policy to local cluster. // PeerBucketPolicyHandler - copies/deletes policy to local cluster.
func (c *SiteReplicationSys) PeerBucketPolicyHandler(ctx context.Context, bucket string, policy *bktpolicy.Policy, updatedAt time.Time) error { func (c *SiteReplicationSys) PeerBucketPolicyHandler(ctx context.Context, bucket string, policy *policy.BucketPolicy, updatedAt time.Time) error {
// skip overwrite if local update is newer than peer update. // skip overwrite if local update is newer than peer update.
if !updatedAt.IsZero() { if !updatedAt.IsZero() {
if _, updateTm, err := globalBucketMetadataSys.GetPolicyConfig(bucket); err == nil && updateTm.After(updatedAt) { if _, updateTm, err := globalBucketMetadataSys.GetPolicyConfig(bucket); err == nil && updateTm.After(updatedAt) {
@ -2880,10 +2879,10 @@ func (c *SiteReplicationSys) siteReplicationStatus(ctx context.Context, objAPI O
if opts.Policies || opts.Entity == madmin.SRPolicyEntity { if opts.Policies || opts.Entity == madmin.SRPolicyEntity {
// collect IAM policy replication status across sites // collect IAM policy replication status across sites
for p, pslc := range policyStats { for p, pslc := range policyStats {
var policies []*iampolicy.Policy var policies []*policy.Policy
uPolicyCount := 0 uPolicyCount := 0
for _, ps := range pslc { for _, ps := range pslc {
plcy, err := iampolicy.ParseConfig(bytes.NewReader([]byte(ps.SRIAMPolicy.Policy))) plcy, err := policy.ParseConfig(bytes.NewReader([]byte(ps.SRIAMPolicy.Policy)))
if err != nil { if err != nil {
continue continue
} }
@ -2924,7 +2923,7 @@ func (c *SiteReplicationSys) siteReplicationStatus(ctx context.Context, objAPI O
for b, slc := range bucketStats { for b, slc := range bucketStats {
tagSet := set.NewStringSet() tagSet := set.NewStringSet()
olockConfigSet := set.NewStringSet() olockConfigSet := set.NewStringSet()
policies := make([]*bktpolicy.Policy, numSites) policies := make([]*policy.BucketPolicy, numSites)
replCfgs := make([]*sreplication.Config, numSites) replCfgs := make([]*sreplication.Config, numSites)
quotaCfgs := make([]*madmin.BucketQuota, numSites) quotaCfgs := make([]*madmin.BucketQuota, numSites)
sseCfgSet := set.NewStringSet() sseCfgSet := set.NewStringSet()
@ -2974,7 +2973,7 @@ func (c *SiteReplicationSys) siteReplicationStatus(ctx context.Context, objAPI O
} }
} }
if len(s.Policy) > 0 { if len(s.Policy) > 0 {
plcy, err := bktpolicy.ParseConfig(bytes.NewReader(s.Policy), b) plcy, err := policy.ParseBucketPolicyConfig(bytes.NewReader(s.Policy), b)
if err != nil { if err != nil {
continue continue
} }
@ -3125,12 +3124,12 @@ func isReplicated(cntReplicated, total int, valSet set.StringSet) bool {
// isIAMPolicyReplicated returns true if count of replicated IAM policies matches total // isIAMPolicyReplicated returns true if count of replicated IAM policies matches total
// number of sites and IAM policies are identical. // number of sites and IAM policies are identical.
func isIAMPolicyReplicated(cntReplicated, total int, policies []*iampolicy.Policy) bool { func isIAMPolicyReplicated(cntReplicated, total int, policies []*policy.Policy) bool {
if cntReplicated > 0 && cntReplicated != total { if cntReplicated > 0 && cntReplicated != total {
return false return false
} }
// check if policies match between sites // check if policies match between sites
var prev *iampolicy.Policy var prev *policy.Policy
for i, p := range policies { for i, p := range policies {
if i == 0 { if i == 0 {
prev = p prev = p
@ -3233,7 +3232,7 @@ func isBktQuotaCfgReplicated(total int, quotaCfgs []*madmin.BucketQuota) bool {
// isBktPolicyReplicated returns true if count of replicated bucket policies matches total // isBktPolicyReplicated returns true if count of replicated bucket policies matches total
// number of sites and bucket policies are identical. // number of sites and bucket policies are identical.
func isBktPolicyReplicated(total int, policies []*bktpolicy.Policy) bool { func isBktPolicyReplicated(total int, policies []*policy.BucketPolicy) bool {
numPolicies := 0 numPolicies := 0
for _, p := range policies { for _, p := range policies {
if p == nil { if p == nil {
@ -3245,7 +3244,7 @@ func isBktPolicyReplicated(total int, policies []*bktpolicy.Policy) bool {
return false return false
} }
// check if policies match between sites // check if policies match between sites
var prev *bktpolicy.Policy var prev *policy.BucketPolicy
for i, p := range policies { for i, p := range policies {
if p == nil { if p == nil {
continue continue

View File

@ -36,7 +36,7 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/rest" "github.com/minio/minio/internal/rest"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
xbufio "github.com/philhofer/fwd" xbufio "github.com/philhofer/fwd"
"github.com/tinylib/msgp/msgp" "github.com/tinylib/msgp/msgp"
) )

View File

@ -45,7 +45,7 @@ import (
xjwt "github.com/minio/minio/internal/jwt" xjwt "github.com/minio/minio/internal/jwt"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
var errDiskStale = errors.New("drive stale") var errDiskStale = errors.New("drive stale")

View File

@ -26,7 +26,7 @@ import (
"testing" "testing"
"github.com/minio/mux" "github.com/minio/mux"
xnet "github.com/minio/pkg/net" xnet "github.com/minio/pkg/v2/net"
) )
// Storage REST server, storageRESTReceiver and StorageRESTClient are // Storage REST server, storageRESTReceiver and StorageRESTClient are

View File

@ -36,8 +36,8 @@ import (
xhttp "github.com/minio/minio/internal/http" xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/mux" "github.com/minio/mux"
iampolicy "github.com/minio/pkg/iam/policy" iampolicy "github.com/minio/pkg/v2/policy"
"github.com/minio/pkg/wildcard" "github.com/minio/pkg/v2/wildcard"
) )
const ( const (

Some files were not shown because too many files have changed in this diff Show More