Skip to content

Commit a32449c

Browse files
author
Anis Eleuch
committed
Allow SVC creation when CreateServiceAccount is denied with a condition
Adding this policy will make the user not able to create a service account anymore: ``` { "Effect": "Deny", "Action": [ "admin:CreateServiceAccount" ], "Condition": { "NumericGreaterThanIfExists": {"svc:DurationSeconds": "1500"} } }, ``` The reason is that policy.IsAllowedActions() is called with conditions from the user login. Assume svc account creation to be possible for now until we come up with a better fix
1 parent 02a0db1 commit a32449c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/user_session.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ func getSessionResponse(ctx context.Context, session *models.Principal) (*models
139139

140140
defaultActions := policy.IsAllowedActions("", "", conditionValues)
141141

142+
// Allow Create Access Key when admin:CreateServiceAccount is provided with a condition
143+
for _, statement := range policy.Statements {
144+
if statement.Effect == "Deny" && len(statement.Conditions) > 0 &&
145+
statement.Actions.Contains(minioIAMPolicy.CreateServiceAccountAdminAction) {
146+
defaultActions.Add(minioIAMPolicy.Action(minioIAMPolicy.CreateServiceAccountAdminAction))
147+
}
148+
}
149+
142150
permissions := map[string]minioIAMPolicy.ActionSet{
143151
ConsoleResourceName: defaultActions,
144152
}

0 commit comments

Comments
 (0)