fix(api-server): require auth for /health/detailed and fail closed on weak keys - #265
Open
hashbender wants to merge 1 commit into
Open
fix(api-server): require auth for /health/detailed and fail closed on weak keys#265hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
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 NousResearch#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
Mirror-of: NousResearch#56260
NousResearch#56260