diff --git a/cmd/admin-handlers-users.go b/cmd/admin-handlers-users.go index 43e8ef543..97dec6482 100644 --- a/cmd/admin-handlers-users.go +++ b/cmd/admin-handlers-users.go @@ -605,7 +605,6 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque ConditionValues: getConditionValues(r, "", cred.AccessKey, claims), IsOwner: owner, Claims: claims, - DenyOnly: true, }) { writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrAccessDenied), r.URL) return diff --git a/cmd/admin-handlers-users_test.go b/cmd/admin-handlers-users_test.go index 1f9f94316..1677bcff5 100644 --- a/cmd/admin-handlers-users_test.go +++ b/cmd/admin-handlers-users_test.go @@ -890,6 +890,9 @@ func (s *TestSuiteIAM) TestServiceAccountOpsByUser(c *check) { // 5. Check that service account can be deleted. c.assertSvcAccDeletion(ctx, s, userAdmClient, accessKey, bucket) + + // 6. Check that service account cannot be created for some other user. + c.mustNotCreateSvcAccount(ctx, globalActiveCred.AccessKey, userAdmClient) } func (s *TestSuiteIAM) TestServiceAccountOpsByAdmin(c *check) { diff --git a/cmd/sts-handlers_test.go b/cmd/sts-handlers_test.go index 86a19efd1..7ea02b581 100644 --- a/cmd/sts-handlers_test.go +++ b/cmd/sts-handlers_test.go @@ -625,6 +625,9 @@ func (s *TestSuiteIAM) TestLDAPSTSServiceAccounts(c *check) { // 5. Check that service account can be deleted. c.assertSvcAccDeletion(ctx, s, userAdmClient, value.AccessKeyID, bucket) + + // 6. Check that service account cannot be created for some other user. + c.mustNotCreateSvcAccount(ctx, globalActiveCred.AccessKey, userAdmClient) } // In this test, the parent users gets their permissions from a group, rather @@ -725,6 +728,9 @@ func (s *TestSuiteIAM) TestLDAPSTSServiceAccountsWithGroups(c *check) { // 5. Check that service account can be deleted. c.assertSvcAccDeletion(ctx, s, userAdmClient, value.AccessKeyID, bucket) + + // 6. Check that service account cannot be created for some other user. + c.mustNotCreateSvcAccount(ctx, globalActiveCred.AccessKey, userAdmClient) } func (s *TestSuiteIAM) TestOpenIDSTS(c *check) { @@ -979,6 +985,9 @@ func (s *TestSuiteIAM) TestOpenIDServiceAcc(c *check) { // 5. Check that service account can be deleted. c.assertSvcAccDeletion(ctx, s, userAdmClient, value.AccessKeyID, bucket) + + // 6. Check that service account cannot be created for some other user. + c.mustNotCreateSvcAccount(ctx, globalActiveCred.AccessKey, userAdmClient) } var testAppParams = OpenIDClientAppParams{