Return error when attempting to create a policy with commas in name (#20724)

This commit is contained in:
Taran Pelkey
2024-12-04 06:51:26 -05:00
committed by GitHub
parent eddbe6bca2
commit aff2a76d80
4 changed files with 218 additions and 199 deletions

View File

@@ -1719,6 +1719,12 @@ func (a adminAPIHandlers) AddCannedPolicy(w http.ResponseWriter, r *http.Request
}
setReqInfoPolicyName(ctx, policyName)
// Reject policy names with commas.
if strings.Contains(policyName, ",") {
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrPolicyInvalidName), r.URL)
return
}
// Error out if Content-Length is missing.
if r.ContentLength <= 0 {
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrMissingContentLength), r.URL)