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

Prometheus HTTP endpoint can have custom authentication #6013

Open
Tracked by #21121
asafm opened this issue Nov 26, 2023 · 5 comments
Open
Tracked by #21121

Prometheus HTTP endpoint can have custom authentication #6013

asafm opened this issue Nov 26, 2023 · 5 comments
Labels
Feature Request Suggest an idea for this project

Comments

@asafm
Copy link
Contributor

asafm commented Nov 26, 2023

Is your feature request related to a problem? Please describe.
Prometheus HTTP endpoint today is unauthenticated. Some attributes may contain sensitive data, hence having the ability to customize access to it would solve that.

Describe the solution you'd like
Ability to customize the HttpContext created for metrics handler, using a functional interface (Consumer<HttpContext>) given in the builder of ProtheusHttpServer. This will allow setting authentication using Filter or Autheticator.

Describe alternatives you've considered
Let the apps wrap them selfs with another proxy implementing the authentication. Aside from the complexity of adding another process doing the authentication, there are cases when the authentication is already implemented inside the app for all other HTTP Endpoints, thus it makes sense to do the authentication in the same app using same code and data. Apache Pulsar is an example. Users can provide an AuthenticationProvider plugin, and each request to Pulsar will use it for authentication. Forcing Pulsar users to spin up a proxy which implements the Pulsar code for authentication is awfully complicated.

@fstab
Copy link
Member

fstab commented Nov 27, 2023

Related: The upstream HTTPServer from the Prometheus Java client can be configured with an Authenticator, so if #6015 gets merged this could be implemented deferring to upstream API.

@asafm
Copy link
Contributor Author

asafm commented Nov 27, 2023

@fstab 6105 has several major drawbacks discussed with @jack-berg at #5940 which makes it too big of an obstacle to merge IMO.

Specifically in this issue, supporting an Authenticator is so easy in terms of added code, I wouldn't want to bring a mountain of code and dependency just to do it.

@echooymxq
Copy link

What's going on now? the PrometheusHttpServer still can't custom authentication.

@jack-berg
Copy link
Member

PRs to extend PrometheusHttpServerBuilder with a setAuthenticator(com.sun.net.httpserver.Authenticator) method are welcome.

@asafm
Copy link
Contributor Author

asafm commented Sep 25, 2024

I've moved on to another company and don't have time to continue implementing this, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Suggest an idea for this project
Projects
None yet
Development

No branches or pull requests

4 participants