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

Apiserver allows requests with empty location path #52922

Closed
wants to merge 1 commit into from

Conversation

roycaihw
Copy link
Member

What this PR does / why we need it:
Revert part of #52065 to allow requests with empty location path, which should still be considered valid HTTP requests. Currently empty location paths are rewritten into "/", which breaks the redirection hack and changes the behavior in the related issues below.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #52813, fixes #52729

Special notes for your reviewer:
The related issues reported behavior change between 1.7.5 and 1.7.6. This PR might need to be cherry-picked into 1.7 as #52065 does.

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 22, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @roycaihw. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 22, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: roycaihw
We suggest the following additional approver: wojtek-t

Assign the PR to them by writing /assign @wojtek-t in a comment when ready.

Associated issue: 52065

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 22, 2017
@roycaihw
Copy link
Member Author

/assign @liggitt
/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Sep 22, 2017
@liggitt
Copy link
Member

liggitt commented Sep 22, 2017

Can you add a test for the redirection case to make sure this doesn’t regress?

@@ -70,7 +70,9 @@ func (r *ProxyREST) Connect(ctx genericapirequest.Context, id string, opts runti
if err != nil {
return nil, err
}
location.Path = path.Join("/", location.Path, proxyOpts.Path)
if location.Path != "" || proxyOpts.Path != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I’m not sure this is right… what gets populated in proxyOpts.Path for “.../nodes/foo/proxy” and “.../nodes/foo/proxy/“?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty strings I suppose. The if condition only affects the case when both location.Path and proxyOpts.Path are empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the right fix is to fix the way proxyOpts.Path is populated for proxy subresources to preserve any leading and trailing slashes. Opened #52933 to do that instead

@liggitt liggitt added kind/bug Categorizes issue or PR as related to a bug. cherrypick-candidate labels Sep 22, 2017
@k8s-cherrypick-bot
Copy link

Removing label cherrypick-candidate because no release milestone was set. This is an invalid state and thus this PR is not being considered for cherry-pick to any release branch. Please add an appropriate release milestone and then re-add the label.

@liggitt
Copy link
Member

liggitt commented Sep 23, 2017

fixed by #52933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubectl proxy doesn't redirect to kubernetes dashboard correctly Kubectl Proxy to Dashboard broken in 1.7.6
7 participants