-
Notifications
You must be signed in to change notification settings - Fork 41k
Limit the number of operations in a single json patch to be 10,000 #74000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit the number of operations in a single json patch to be 10,000 #74000
Conversation
95acaf9
to
5e6fc5d
Compare
@@ -331,6 +336,11 @@ func (p *jsonPatcher) applyJSPatch(versionedJS []byte) (patchedJS []byte, retErr | |||
if err != nil { | |||
return nil, errors.NewBadRequest(err.Error()) | |||
} | |||
if len(patchObj) > maxJSONPatchOperations { | |||
return nil, errors.NewRequestEntityTooLargeError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had also considered 422 unprocessable entity, but that's for semantic error.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: caesarxuchao, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
related to #74534 |
make complains: ``` Unformatted Go source code: ./pkg/k8s/json_patch.go diff -u ./pkg/k8s/json_patch.go.orig ./pkg/k8s/json_patch.go --- ./pkg/k8s/json_patch.go.orig 2019-04-22 16:48:14.987138041 -0700 +++ ./pkg/k8s/json_patch.go 2019-04-22 16:48:14.987138041 -0700 @@ -14,7 +14,7 @@ package k8s -const( +const ( // maximum number of operations a single json patch may contain. // See kubernetes/kubernetes#74000 MaxJSONPatchOperations = 10000 ``` Fix it Signed-off-by: Joe Stringer <joe@cilium.io>
make complains: ``` Unformatted Go source code: ./pkg/k8s/json_patch.go diff -u ./pkg/k8s/json_patch.go.orig ./pkg/k8s/json_patch.go --- ./pkg/k8s/json_patch.go.orig 2019-04-22 16:48:14.987138041 -0700 +++ ./pkg/k8s/json_patch.go 2019-04-22 16:48:14.987138041 -0700 @@ -14,7 +14,7 @@ package k8s -const( +const ( // maximum number of operations a single json patch may contain. // See kubernetes/kubernetes#74000 MaxJSONPatchOperations = 10000 ``` Fix it Signed-off-by: Joe Stringer <joe@cilium.io>
/kind bug
/sig api-machinery
/assign