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

Add '--allow-paths' CLI flag #83

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

simonpasquier
Copy link
Contributor

No description provided.

@brancz
Copy link
Owner

brancz commented Aug 12, 2020

What's the concrete use case we have here? I'm just wondering if regex is really the right thing for this or if we should rather use a list of slightly less flexible template strings. I'm just worried that this will be used accidentally incorrectly and then causes potential security problems (which my understanding is is exactly what we're trying to avoid).

@simonpasquier
Copy link
Contributor Author

The concrete use case is when you have several kube-rbac-proxies in front of the same backend with different permissions for each proxy.
For instance, a Thanos querier with 2 kube-rbac-proxy instances:

  • kube-rbac-proxy#1 for the /api/v1/query and /api/v1/query_range endpoints if the user has permissions to get pod's metrics.
  • kube-rbac-proxy#2 for the /api/v1/rules endpoint if the user has permissions to get the prometheus rules.

I think it's also fine if we have to specify all paths that are managed by the proxy.

@brancz
Copy link
Owner

brancz commented Aug 12, 2020

I'm all for enabling the use case but I feel getting regexes right in order for a security feature to work doesn't seem like a good idea, I'd be more comfortable to have explicit paths each listed without regex support. That should still fulfill the requirement no?

@simonpasquier
Copy link
Contributor Author

simonpasquier commented Aug 12, 2020

That should still fulfill the requirement no?

Completely. I'll update the PR accordingly :)

kube-rbac-proxy checks that the incoming request matches with one of the
paths specified by the flag. If not, it returns a 404 status code. If
omitted (the default), kube-rbac-proxy doesn't check the incoming
request path (same as previously).

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@simonpasquier simonpasquier force-pushed the allow-paths-regex branch 2 times, most recently from 36a6175 to 7bc0757 Compare August 12, 2020 14:07
@brancz brancz merged commit 7a08ef9 into brancz:master Aug 13, 2020
@@ -190,6 +191,90 @@ func testTokenAudience(s *kubetest.Suite) kubetest.TestSuite {
}
}

func testAllowPathsRegexp(s *kubetest.Suite) kubetest.TestSuite {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@simonpasquier maybe as a small follow-up: s/testAllowPathsRegexp/testAllowPaths ?

@s-urbaniak s-urbaniak changed the title Add '--allow-paths-regex' CLI flag Add '--allow-paths' CLI flag Aug 17, 2020
@simonpasquier simonpasquier deleted the allow-paths-regex branch August 19, 2020 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants