Repository navigation
Description
What
The metrics and health HTTP listeners bind :port — all interfaces — and the address is not
configurable. An operator who wants them reachable only from the host cannot express that in
configuration; the only options are "all interfaces" or "off".
Verified
internal/metrics/collector.go:155:
c.server = &http.Server{
Addr: fmt.Sprintf(":%d", c.config.Port),internal/health/checker.go:482:
ln, err := lc.Listen(ctx, "tcp", fmt.Sprintf(":%d", c.config.HTTPPort))Confirmed by dialling a live collector from a non-loopback address of the same host:
RESULT: reachable on non-loopback 192.168.6.94:18081 — binds all interfaces
Both are on by default (monitoring.metrics.enabled: true,
monitoring.health_checks.enabled: true in config.NewDefault), so a stock objectfs s3://bucket /mnt opens two unauthenticated ports to the network.
Why it matters
Neither endpoint serves object contents, keys, or credentials, so this is not a data-disclosure
bug. But /debug/operations and /metrics between them give per-operation counts, error rates,
sizes, and timings — enough to characterize what a bucket is being used for and when — and neither
has any authentication. On a shared HPC login node or anything with a public interface, that is
exposed to every host that can route to it.
There is prior art in this repo for the shape of the fix: MonitoringConfig already carries
MetricsAddr: ":9090" and HealthCheckAddr: ":8081" string fields (internal/config/config.go:570,572)
which are read by nothing. Either wire those (and reconcile them with global.metrics_port /
global.health_port, which are the fields actually used — two sources for one setting is its own
defect) or add explicit bind-address fields.
Proposed
- A bind address per listener, defaulting to
127.0.0.1rather than all interfaces. Defaulting to
loopback is the safer default and does not break a Prometheus scrape from the same host; a
cross-host scrape becomes an explicit opt-in, which is the right way round. - Resolve the duplication:
MetricsAddr/HealthCheckAddrvsMetricsPort/HealthPort. One of
each pair should exist. The dead ones should be deleted, not left to be discovered again. - A test that asserts the bound address, not just that something is listening — the current
TestStartMetricsBindsTheEndpointscrapes127.0.0.1and passes either way.
Related: #211 (metrics_port: 0 does not disable the listener).
Activity
fix: one address per listener, beside the flag that enables it (#246)
scttfrdmn commentedon Aug 3, 2026
Fixed and shipped in the v0.11.0 Unreleased changelog, under Each listener's address is one setting, beside the
enabledflag that governs it.Both listeners now bind
monitoring.metrics.addrandmonitoring.health_checks.addr, defaulting to loopback —127.0.0.1:8080and127.0.0.1:8081ininternal/config.DefaultMetricsAddr/DefaultHealthAddr. Same ports as before, so a same-host Prometheus scrape keeps working; the host is what changed.The address is configurable because it is now the only setting:
global.metrics_port,global.health_port,monitoring.metrics_addrandmonitoring.health_check_addrare all removed. That set is the whole defect —monitoringdeclared the two addresses, defaulted them, documented them, and read neither, while the ports two sections away were what the listeners used and could not express a host at all, since the bind wasfmt.Sprintf(":%d", port).The test gap was the more interesting half:
TestStartMetricsBindsTheEndpointscraped127.0.0.1and passed against a wildcard bind, because a wildcard bind answers on loopback too. It now asserts on the address the listener reports, which is the one thing that differs.test: close the same window in internal/health, and give Checker an Addr
test: close the ephemeral-port window that failed a CI run (#392)