mirror of
https://github.com/ferdzo/fs.git
synced 2026-06-04 05:06:46 +00:00
Harden S3 auth boundaries
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -33,14 +33,16 @@ func statementMatches(stmt models.AuthPolicyStatement, target RequestTarget) boo
|
||||
if !bucketMatches(stmt.Bucket, target.Bucket) {
|
||||
return false
|
||||
}
|
||||
if target.Key == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
prefix := strings.TrimSpace(stmt.Prefix)
|
||||
if prefix == "" || prefix == "*" {
|
||||
return true
|
||||
}
|
||||
if target.Key == "" {
|
||||
if target.Action == ActionListBucket {
|
||||
return strings.HasPrefix(target.Prefix, prefix)
|
||||
}
|
||||
return true
|
||||
}
|
||||
return strings.HasPrefix(target.Key, prefix)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user