Skip to content

Commit d0f744e

Browse files
vadmesteAnis Eleuchprakashsvmx
authored
svc: Assume access key creation permission to be available by default (#3306)
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 Co-authored-by: Anis Eleuch <anis@min.io> Co-authored-by: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com>
1 parent a8c043c commit d0f744e

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)