fix(api-server): require auth for /health/detailed and fail closed on weak keys - #56260
Merged
Conversation
Collaborator
teknium1
force-pushed
the
salvage/44073-b-api-server
branch
2 times, most recently
from
July 1, 2026 10:30
2569988 to
43c6dd2
Compare
… weak keys /health/detailed leaked runtime state (gateway state, connected platforms, active-agent counts, PID, exit reason) with no auth. Gate it behind the same Bearer auth as other API routes; plain /health stays open for liveness probes. Also refuse to start on a placeholder/too-short (<16 char) API_SERVER_KEY regardless of bind address — a guessable key on a terminal-capable endpoint is RCE-adjacent even on loopback, since any local process can reach it. The required-key check was already unconditional; this extends the strength floor to loopback binds too. Startup guards are hoisted above app/background-task creation so a rejected start leaves no partial state. Salvaged from #44073 (external-surface hardening), split into a focused PR per maintainer request. Co-authored-by: Hermes Agent <agent@nousresearch.com>
teknium1
force-pushed
the
salvage/44073-b-api-server
branch
from
July 1, 2026 11:03
43c6dd2 to
a1141c3
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The API server's
/health/detailedendpoint now requires Bearer auth, and the server refuses to start on a weak/placeholder key on any bind — closing two external-surface fail-open paths.Salvaged from #44073 (@SahilRakhaiya05), split into a focused PR per maintainer request.
Changes
gateway/platforms/api_server.py:/health/detailednow runs_check_auth— it exposed gateway state, connected platforms, active-agent counts, PID, and exit reason with no auth. Plain/healthstays open for container liveness probes.<16-charAPI_SERVER_KEYon all binds (previously only network-accessible binds). A guessable key on a terminal-capable endpoint is RCE-adjacent even on loopback. The required-key check was already unconditional; this extends the strength floor._api_key_passes_startup_guard,_port_is_available) are hoisted above app + background-task creation so a rejected start leaves no partial state./health/detailed→ 401 without auth / 200 with; weak key → refuse start with no app and no background tasks.Validation
/health/detailedno auth/health/detailedwith auth/healthlivenesstest_api_server*Note: existing loopback deployments with a
<16-charAPI_SERVER_KEYwill now be refused at startup — intentional for a terminal-capable endpoint. Fix is to set a strong key (openssl rand -hex 32).Infographic