svc: Disallow creating services accounts by root (#12062)

This commit is contained in:
Anis Elleuch 2021-04-15 16:43:44 +01:00 committed by GitHub
parent 291d2793ca
commit 150f3677d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -491,6 +491,12 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque
}
// Disallow creating service accounts by root user.
if owner {
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrAdminAccountNotEligible), r.URL)
return
}
// Disallow creating service accounts for root user.
if createReq.TargetUser == globalActiveCred.AccessKey {
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrAdminAccountNotEligible), r.URL)
return