mirror of
https://github.com/versity/versitygw.git
synced 2026-09-18 22:14:24 +00:00
fix: Prioritize explicit deny in bucket policy statements
This commit is contained in:
@@ -48,18 +48,19 @@ func (bp *BucketPolicy) Validate(bucket string, iam IAMService) error {
|
||||
}
|
||||
|
||||
func (bp *BucketPolicy) isAllowed(principal string, action Action, resource string) bool {
|
||||
var isAllowed bool
|
||||
for _, statement := range bp.Statement {
|
||||
if statement.findMatch(principal, action, resource) {
|
||||
switch statement.Effect {
|
||||
case BucketPolicyAccessTypeAllow:
|
||||
return true
|
||||
isAllowed = true
|
||||
case BucketPolicyAccessTypeDeny:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
return isAllowed
|
||||
}
|
||||
|
||||
type BucketPolicyItem struct {
|
||||
|
||||
Reference in New Issue
Block a user