METRICS_USERNAME set with an empty METRICS_PASSWORD publishes /metrics unauthenticated #205
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
/metricsroute mounts on the username alone (internal/server/routes.go:59,:107), andMetricsAuthbuilds its credential map with whatever password it was given, empty included (internal/middleware/middleware.go:452-463).Verified live with
METRICS_USERNAME=metricsandMETRICS_PASSWORDunset:while startup logged
hasMetricsAuth:falseand did not refuse to start. So the config is internally inconsistent — one layer thinks auth is off, the other mounts the route — and a half-set config silently publishes the endpoint.This is the
config-fails-loudlyrule: a set-but-invalid configuration must abort startup rather than degrade into something the operator did not ask for.Definition of done:
METRICS_USERNAMEset with an empty or unsetMETRICS_PASSWORDis a startup error naming both variables; the process exits non-zeroMETRICS_PASSWORDset,METRICS_USERNAMEempty) is the same error/metricsunmountedhasMetricsAuthcannot disagree with whether the route is mounted; derive both from one valueclawbot referenced this issue2026-08-20 06:27:17 +02:00