aboutsummaryrefslogtreecommitdiff
path: root/weed/iamapi/iamapi_management_handlers.go
diff options
context:
space:
mode:
authorTom Crasset <25140344+tcrasset@users.noreply.github.com>2025-01-17 10:03:17 +0100
committerGitHub <noreply@github.com>2025-01-17 01:03:17 -0800
commitc5f21b2b01deb10a542455b95285860a53f1f4d0 (patch)
tree4d4ae04e47758a3f41e2071526a72306ac02a4f7 /weed/iamapi/iamapi_management_handlers.go
parenteab2e0e1127e2d8ccdee9ee518e0ae20ea8311ba (diff)
downloadseaweedfs-c5f21b2b01deb10a542455b95285860a53f1f4d0.tar.xz
seaweedfs-c5f21b2b01deb10a542455b95285860a53f1f4d0.zip
fix S3 per-user-directory Policy (#6443)
* fix S3 per-user-directory Policy * Delete docker/config.json * add tests * remove logs * undo modifications of weed/shell/command_volume_balance.go * remove modifications of docker-compose * fix failing test --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Diffstat (limited to 'weed/iamapi/iamapi_management_handlers.go')
-rw-r--r--weed/iamapi/iamapi_management_handlers.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.go
index e5c533e27..baa153cd6 100644
--- a/weed/iamapi/iamapi_management_handlers.go
+++ b/weed/iamapi/iamapi_management_handlers.go
@@ -332,26 +332,23 @@ func GetActions(policy *PolicyDocument) ([]string, error) {
// Parse "arn:aws:s3:::my-bucket/shared/*"
res := strings.Split(resource, ":")
if len(res) != 6 || res[0] != "arn" || res[1] != "aws" || res[2] != "s3" {
- return nil, fmt.Errorf("not a valid resource: '%s'. Expected prefix 'arn:aws:s3'", res)
+ glog.Infof("not a valid resource: %s", res)
+ continue
}
for _, action := range statement.Action {
// Parse "s3:Get*"
act := strings.Split(action, ":")
if len(act) != 2 || act[0] != "s3" {
- return nil, fmt.Errorf("not a valid action: '%s'. Expected prefix 's3:'", act)
+ glog.Infof("not a valid action: %s", act)
+ continue
}
statementAction := MapToStatementAction(act[1])
- if res[5] == "*" {
+ path := res[5]
+ if path == "*" {
actions = append(actions, statementAction)
continue
}
- // Parse my-bucket/shared/*
- path := strings.Split(res[5], "/")
- if len(path) != 2 || path[1] != "*" {
- glog.Infof("not match bucket: %s", path)
- continue
- }
- actions = append(actions, fmt.Sprintf("%s:%s", statementAction, path[0]))
+ actions = append(actions, fmt.Sprintf("%s:%s", statementAction, path))
}
}
}