Merge pull request #106576 from liggitt/bad-request-patch

Return BadRequest for invalid large patch
This commit is contained in:
Kubernetes Prow Robot 2021-11-21 13:05:00 -08:00 committed by GitHub
commit a8c9dd6274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -412,6 +412,9 @@ func (p *jsonPatcher) applyJSPatch(versionedJS []byte) (patchedJS []byte, strict
}
patchedJS, retErr = jsonpatch.MergePatch(versionedJS, p.patchBytes)
if retErr == jsonpatch.ErrBadJSONPatch {
return nil, nil, errors.NewBadRequest(retErr.Error())
}
return patchedJS, strictErrors, retErr
default:
// only here as a safety net - go-restful filters content-type