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

Securing the metrics endpoint #29

Open
Radiergummi opened this issue Jan 2, 2021 · 0 comments
Open

Securing the metrics endpoint #29

Radiergummi opened this issue Jan 2, 2021 · 0 comments

Comments

@Radiergummi
Copy link

Radiergummi commented Jan 2, 2021

This is both a question—how do other users of this package secure the endpoint?—and a suggestion: Maybe it would be a good idea to add a section on security to the readme. I'm well aware someone integrating Prometheus into their ecosystem probably knows what they do, but opening up metrics accidentally may still be a huge threat vector.
Therefore I'd like to collect strategies to secure the endpoint, and maybe come up with a secure default to recommend in the readme.

We currently use a middleware that checks the source IP against an allowlist of Prometheus instances (simplified):

public function handle($request, Closure $next)
{
    if (in_array($request->ip(), config('services.prometheus.allowed_ips'), true) {
        return abort(404);
    }

    return $next($request);
}
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

No branches or pull requests

1 participant