Skip to content

Commit a7188bc

Browse files
authored
fix: evaluate BypassGov policy action in deletion correctly (#16635)
1 parent e1e9ddd commit a7188bc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cmd/bucket-object-lock.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,8 @@ func enforceRetentionBypassForDelete(ctx context.Context, r *http.Request, bucke
156156
return ErrNone
157157
}
158158
// https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html#object-lock-retention-modes
159-
// If you try to delete objects protected by governance mode and have s3:BypassGovernanceRetention
160-
// or s3:GetBucketObjectLockConfiguration permissions, the operation will succeed.
161-
govBypassPerms1 := checkRequestAuthType(ctx, r, policy.BypassGovernanceRetentionAction, bucket, object.ObjectName)
162-
govBypassPerms2 := checkRequestAuthType(ctx, r, policy.GetBucketObjectLockConfigurationAction, bucket, object.ObjectName)
163-
if govBypassPerms1 != ErrNone && govBypassPerms2 != ErrNone {
159+
// If you try to delete objects protected by governance mode and have s3:BypassGovernanceRetention, the operation will succeed.
160+
if checkRequestAuthType(ctx, r, policy.BypassGovernanceRetentionAction, bucket, object.ObjectName) != ErrNone {
164161
return ErrAccessDenied
165162
}
166163
}

0 commit comments

Comments
 (0)