S3 authorization: StreamingSigned enforces access control
fix https://github.com/chrislusf/seaweedfs/issues/2180
This commit is contained in:
@@ -85,11 +85,17 @@ func (iam *IdentityAccessManagement) calculateSeedSignature(r *http.Request) (cr
|
|||||||
return nil, "", "", time.Time{}, errCode
|
return nil, "", "", time.Time{}, errCode
|
||||||
}
|
}
|
||||||
// Verify if the access key id matches.
|
// Verify if the access key id matches.
|
||||||
_, cred, found := iam.lookupByAccessKey(signV4Values.Credential.accessKey)
|
identity, cred, found := iam.lookupByAccessKey(signV4Values.Credential.accessKey)
|
||||||
if !found {
|
if !found {
|
||||||
return nil, "", "", time.Time{}, s3err.ErrInvalidAccessKeyID
|
return nil, "", "", time.Time{}, s3err.ErrInvalidAccessKeyID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bucket, _ := getBucketAndObject(r)
|
||||||
|
if !identity.canDo("Write", bucket) {
|
||||||
|
errCode = s3err.ErrAccessDenied
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Verify if region is valid.
|
// Verify if region is valid.
|
||||||
region = signV4Values.Credential.scope.region
|
region = signV4Values.Credential.scope.region
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user