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

[WIP] KEP: make RESTClient not to follow redirects by default #1908

Closed

Conversation

knight42
Copy link
Member

@knight42 knight42 commented Jul 27, 2020

Signed-off-by: knight42 anonymousknight96@gmail.com

Motivation: kubernetes/kubernetes#93129

Fixes: #1906

Rendered

/cc @liggitt

Signed-off-by: knight42 <anonymousknight96@gmail.com>
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 27, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: knight42
To complete the pull request process, please assign lavalamp
You can assign the PR to them by writing /assign @lavalamp in a comment when ready.

The full list of commands accepted by this bot can be found 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 kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. labels Jul 27, 2020
@knight42 knight42 changed the title KEP: make RESTClient not to follow redirects by default [WIP] KEP: make RESTClient not to follow redirects by default Jul 27, 2020
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 27, 2020
@k8s-ci-robot
Copy link
Contributor

@knight42: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-enhancements-verify 76571eb link /test pull-enhancements-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

-->
Generally the RESTClient does not need to follow any redirects, but there might be some cases where it is required to follow redirects.

1. If it is required to follow redirects on the client side, i.e. kubectl, we could add a global flag to kubectl, say `--follow-redirect`, to mitigate breakage.
Copy link
Member

@pwittrock pwittrock Oct 1, 2020

Choose a reason for hiding this comment

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

Would the linked example of the type of vulnerability this is trying to prevent have been mitigated by preventing redirects in the apiserver outgoing request, but continuing to follow them in the kubectl client?

We could also expose this as an option in the kubeconfig rather than providing it as a flag.

// other unchanged fields

// FollowRedirect makes the internal HTTP client follow redirects automatically
FollowRedirect bool
Copy link
Member

Choose a reason for hiding this comment

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

Could this be a list of regular expressions of URI's it will follow. For example the client may expect redirects for a set of hosts, but not arbitrary redirects to the public internet.

with and without the feature, are necessary. At the very least, think about
conversion tests if API types are being modified.

### Rollout, Upgrade and Rollback Planning
Copy link
Member

Choose a reason for hiding this comment

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

We could rollout this out as "deprecating redirect following" -- e.g. start with logging warnings to stderr in cases that would begin to fail in a future release, and make it opt-in. Then in a subsequent release make it opt-out. This way folks will have some indication that things will start to fail for them and be able to take action ahead of time.

- [CVE-2020-8559](https://github.com/kubernetes/kubernetes/issues/92914)
- ...(there may be other unrevealed CVEs)

Generally speaking, the RESTClient should work without following any HTTP redirects and we would have an immediate mitigation of the above CVEs if the RESTClient do not follow redirects by default.
Copy link
Member

Choose a reason for hiding this comment

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

Have we seen examples that are not apiserver -> kubelet requests? We could start by disabling redirects for requests made by the apiserver rather than for all clients, or disabling redirects for requests made to the kubelet endpoints that are result in exploits.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 30, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 29, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

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.

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure RESTClient in client-go not to follow redirects by default
4 participants