Skip to content

health: HTTP endpoint binds the wildcard on an unvalidated port, and neither is documented #192

Closed

Description

@scttfrdmn

Two related gaps found while fixing the internal/health coverage floor (commit 2c4f6f9).

The endpoint listens on every interface

Checker.startHTTPServer binds fmt.Sprintf(":%d", c.config.HTTPPort), which is the wildcard — [::]:8081, reachable from anywhere that can route to the host. For a diagnostic endpoint that reports component names, error strings, and check timings, that is a decision worth making deliberately rather than by default.

This was found the hard way: a test that asserted a bind collision by holding 127.0.0.1:8081 watched the server come up on [::]:8081 instead and serve happily.

Options, roughly in order of preference:

  • default to 127.0.0.1 and add a health.http_address for operators who want it exposed
  • keep the wildcard but document it as such

Either is fine; silently binding all interfaces is not.

The port is never range-checked

Global.HealthPort comes from YAML and nothing validates it. health_port: 99999 is a config an operator can write; it fails in the address parse at bind time, logs, and returns — the mount stays up, which is the right call for observability, but the operator gets no health endpoint and only a log line says why. Configuration.Validate() should reject a port outside 1–65535 at load, where the message can name the field.

Covered non-fatally by TestStartHTTPServerSurvivesAnUnbindablePort; this issue is about failing earlier and more clearly.

Neither is documented anywhere

$ grep -rn health_port docs/ README.md configs/ examples/
(no matches)

The knob exists, is read, changes behavior, and appears in no shipped documentation or example config.

Activity

  1. added
    type: bug
    priority: medium
    area: health
    area: config
    on Aug 2, 2026
  2. scttfrdmn commented on Aug 2, 2026

    @scttfrdmn
    OwnerAuthor

    Related: #202. This issue is the health endpoint binding the wildcard on an unvalidated port; #202 is that monitoring.health_check_addr — the setting an operator would use to change it — is declared, defaulted, and read by nothing. Same defect from the other end: an operator who correctly sets health_check_addr: 127.0.0.1:8081 gets a wildcard bind and no warning.

    Both are on v0.11.0 and should be fixed together — the validation this issue asks for and the plumbing #202 asks for are the same code path.

  3. added
    effort: small
    on Aug 3, 2026
  4. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Depends on #202. This issue wants a configurable, validated bind address for the health endpoint. #202 is the one that plumbs the four declared-but-unread monitoring fields, and two of them are exactly what a bind address would be read from — so fixing this first means inventing a config path that #202 then has to reconcile. Do #202, then this and #211 together.

  5. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Fixed and shipped in the v0.11.0 Unreleased changelog. All three halves of this issue are addressed, and one of them deliberately the other way from what the issue proposed.

    The wildcard bind. monitoring.health_checks.addr defaults to 127.0.0.1:8081 (#211). The endpoint is unauthenticated and reports component names and error strings, so loopback is the only defensible default.

    The unvalidated port. The port range is now checked explicitly with the field named, because net.SplitHostPort accepts "99999" — which used to reach net.Listen straight from YAML.

    The documentation. This was the sharpest part of the report: grep -rn health_port docs/ README.md configs/ examples/ returned nothing, so the knobs existed, were read, changed behavior, and appeared in no shipped documentation or example config. README.md now has a Metrics and health endpoints section with both addresses, the curl that reaches each, the environment overrides, and why the defaults are loopback; docs/index.md names the addresses beside the features rather than listing "health monitoring" with nowhere to point a probe.

    One reversal, recorded rather than quietly dropped. This issue argued a bind failure should stay non-fatal as "the right call for observability". It is now fatal and names the address. The reasoning: both servers used to bind on a goroutine and log, so a mount whose metrics port was already taken came up with no endpoint and one line in the log — an operator learns that when a probe starts failing. enabled: false is already how you ask for no endpoint, so a failure to provide one you asked for should be loud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configarea: healtheffort: smallpriority: mediumtype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions