fix(gateway): reject known-weak placeholder credentials at startup - #8677
Closed
teknium1 wants to merge 1 commit into
Closed
fix(gateway): reject known-weak placeholder credentials at startup#8677teknium1 wants to merge 1 commit into
teknium1 wants to merge 1 commit into
Conversation
Port from openclaw/openclaw#64586: users who copy .env.example without changing placeholder values (***,changeme,your_api_key,etc.) now get a clear error message at startup instead of a confusing authentication failure from the platform API. Changes: - Extract _validate_gateway_config() from load_gateway_config() for testability - Check enabled platform tokens against has_usable_secret() from hermes_cli.auth — disabled platforms with placeholder tokens get a clear error log and are auto-disabled - Check API_SERVER_KEY against has_usable_secret() when binding to a network-accessible address — placeholder keys are rejected with a helpful error suggesting openssl rand The existing _PLACEHOLDER_SECRET_VALUES set in hermes_cli/auth.py already contains the right patterns (*,**,***,changeme,your_api_key, placeholder,example,dummy,null,none); this PR extends their use from LLM provider credentials to gateway platform tokens.
teknium1
added a commit
that referenced
this pull request
Apr 13, 2026
Port from openclaw/openclaw#64586: users who copy .env.example without changing placeholder values now get a clear error at startup instead of a confusing auth failure from the platform API. Also rejects placeholder API_SERVER_KEY when binding to a network-accessible address. Cherry-picked from PR #8677.
teknium1
added a commit
that referenced
this pull request
Apr 13, 2026
Port from openclaw/openclaw#64586: users who copy .env.example without changing placeholder values now get a clear error at startup instead of a confusing auth failure from the platform API. Also rejects placeholder API_SERVER_KEY when binding to a network-accessible address. Cherry-picked from PR #8677.
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
Port from openclaw/openclaw#64586: users who copy .env.example without changing placeholder values now get a clear error at startup instead of a confusing auth failure from the platform API. Also rejects placeholder API_SERVER_KEY when binding to a network-accessible address. Cherry-picked from PR NousResearch#8677.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Port from openclaw/openclaw#64586: users who copy .env.example without changing placeholder values now get a clear error at startup instead of a confusing auth failure from the platform API. Also rejects placeholder API_SERVER_KEY when binding to a network-accessible address. Cherry-picked from PR NousResearch#8677.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Port from openclaw/openclaw#64586: users who copy .env.example without changing placeholder values now get a clear error at startup instead of a confusing auth failure from the platform API. Also rejects placeholder API_SERVER_KEY when binding to a network-accessible address. Cherry-picked from PR NousResearch#8677.
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
Port of openclaw/openclaw#64586: rejects known-weak placeholder credentials at gateway startup instead of letting them silently fail against platform APIs.
Problem
When users copy
.env.exampleto.envwithout changing placeholder values like***,changeme, oryour_api_key, the gateway starts up and attempts to authenticate with the platform API using these values. The resulting error from Telegram/Discord/Slack is confusing and doesn't point to the root cause.Solution
Platform token validation (
gateway/config.py):_validate_gateway_config()fromload_gateway_config()for testabilityhas_usable_secret()fromhermes_cli/auth.pyAPI server key validation (
gateway/platforms/api_server.py):has_usable_secret()changemeor***are rejected with a helpful error suggestingopenssl rand -hex 32Architectural Differences from OpenClaw
OpenClaw has a dedicated gateway auth token (
OPENCLAW_GATEWAY_TOKEN) that protects the gateway itself. Hermes-agent uses per-platform tokens (Telegram/Discord/Slack bot tokens) + an optional API server key. This implementation:_PLACEHOLDER_SECRET_VALUESset fromhermes_cli/auth.py(already contains all the right patterns)Tests
11 new tests:
***,changeme,your_api_key,placeholder; accept real tokens; accept empty; skip disabled; catch whitespace-padded)python3 -m pytest tests/gateway/test_weak_credential_guard.py tests/gateway/test_api_server_bind_guard.py -o 'addopts=' -q