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

Make "attach" and "exec" rejection in proxy more explicit #28765

Merged
merged 1 commit into from
Jul 20, 2016

Conversation

nhlfr
Copy link

@nhlfr nhlfr commented Jul 11, 2016

kubectl proxy changed to now allow urls to pods with "attach" or "exec" in the pod name

The more explicit regular expression for rejection makes a possibility of accessing pods (or any other resources) which contain "attach" or "exec" in their names via proxy API. It was not possible before.

Also, the reference for "run" resource was removed, because it doesn't exist in any of k8s APIs currently.

Fixes: #21464

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Jul 11, 2016
@@ -35,7 +35,7 @@ import (
const (
DefaultHostAcceptRE = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$"
DefaultPathAcceptRE = "^/.*"
DefaultPathRejectRE = "^/api/.*/exec,^/api/.*/run,^/api/.*/attach"
Copy link
Member

@pwittrock pwittrock Jul 14, 2016

Choose a reason for hiding this comment

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

What was /run originally meant to cover, and why don't we care about it now?

Copy link
Author

Choose a reason for hiding this comment

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

It probably meant to cover the /run endpoint in kubelet. But I'm not sure, I'm new to kubernetes, I'm only a little bit familiar with its code since 1.2. 😒 The one thing is clear - there is no /run API endpoint in apiserver.

Copy link
Member

Choose a reason for hiding this comment

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

What do you think of just tightening to:

^/api/./pods/./exec
^/api/./pods/./attach

I think this will address the issues without opening it up more than is needed.

Copy link
Member

Choose a reason for hiding this comment

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

Thoughts?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I'll change it soon.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

The more explicit regular expression for rejection makes a
possibility of accessing pods (or any other resources) which
contain "attach" or "exec" in their names via proxy API. It
was not possible before.

Also, the reference for "run" resource was removed, because
it doesn't exist in any of k8s APIs currently.

Fixes: kubernetes#21464
@nhlfr nhlfr force-pushed the api-proxy-regex branch from e46f9a1 to 3ed9768 Compare July 19, 2016 18:50
@k8s-bot
Copy link

k8s-bot commented Jul 19, 2016

GCE e2e build/test passed for commit 3ed9768.

@pwittrock pwittrock added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2016
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2016
@pwittrock pwittrock added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Jul 19, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jul 20, 2016

GCE e2e build/test passed for commit 3ed9768.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit ad7ecec into kubernetes:master Jul 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants