Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant