Skip to content

Commit

Permalink
svc: Assume access key creation permission to be available by default (
Browse files Browse the repository at this point in the history
…minio#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 <[email protected]>
Co-authored-by: Prakash Senthil Vel <[email protected]>
  • Loading branch information
3 people authored May 8, 2024
1 parent a8c043c commit d0f744e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/user_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ func getSessionResponse(ctx context.Context, session *models.Principal) (*models

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

// Allow Create Access Key when admin:CreateServiceAccount is provided with a condition
for _, statement := range policy.Statements {
if statement.Effect == "Deny" && len(statement.Conditions) > 0 &&
statement.Actions.Contains(minioIAMPolicy.CreateServiceAccountAdminAction) {
defaultActions.Add(minioIAMPolicy.Action(minioIAMPolicy.CreateServiceAccountAdminAction))
}
}

permissions := map[string]minioIAMPolicy.ActionSet{
ConsoleResourceName: defaultActions,
}
Expand Down

0 comments on commit d0f744e

Please sign in to comment.