fix: Prioritize explicit deny in bucket policy statements

This commit is contained in:
niksis02
2025-03-01 01:14:12 +04:00
parent 3e7654eebc
commit 30f3fac4e1
3 changed files with 90 additions and 2 deletions
+3 -2
View File
@@ -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 {