Skip to content
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

Return BadRequest for invalid large patch #106576

Merged
merged 1 commit into from
Nov 21, 2021

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Nov 21, 2021

What type of PR is this?

/kind bug
/kind failing-test

Which issue(s) this PR fixes:

Fixes #106573

Before https://github.com/kubernetes/kubernetes/pull/105916/files#diff-c4afbb7d6a8bdb1d6475f18abc92caa6c413f879aeeb189187c569f3f6c146f4L366, patches over 1kb were decoded before calling into the jsonpatch library, and any errors returned as a BadRequest.

Since go1.15, the stdlib decoder enforces the stackdepth limits, so we no longer need to do the pre-decode, but we need to treat a returned error decoding the patch as a bad request.

The failing tests were marked as long tests, so they don't run in presubmits, since they submit very large patches to the API server which can stress the presubmit env.

NONE

/cc @aojea @kevindelgado

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 21, 2021
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 21, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2021
@liggitt liggitt added this to the v1.23 milestone Nov 21, 2021
@liggitt liggitt added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Nov 21, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Nov 21, 2021
@liggitt liggitt added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Nov 21, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 21, 2021
@liggitt
Copy link
Member Author

liggitt commented Nov 21, 2021

/cc @apelisse

@aojea
Copy link
Member

aojea commented Nov 21, 2021

Since go1.15, the stdlib decoder enforces the stackdepth limits

heh seems you are familiar with it https://go-review.googlesource.com/c/go/+/199837

so, the test expects BadRequest but we are returning Invalid JSON Patch

t.Errorf("expected success or bad request err, got %v", err)

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 21, 2021
@k8s-ci-robot k8s-ci-robot merged commit a8c9dd6 into kubernetes:master Nov 21, 2021
@liggitt liggitt deleted the bad-request-patch branch November 21, 2021 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Failing test] integration-master
3 participants