mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-30 06:41:51 +00:00
security: harden API server key placeholder handling (#30738)
This commit is contained in:
parent
2df2f9190b
commit
be27bfed01
3 changed files with 15 additions and 1 deletions
|
|
@ -553,6 +553,7 @@ _PLACEHOLDER_SECRET_VALUES = {
|
|||
"***",
|
||||
"changeme",
|
||||
"your_api_key",
|
||||
"your_api_key_here",
|
||||
"your-api-key",
|
||||
"placeholder",
|
||||
"example",
|
||||
|
|
|
|||
13
tests/hermes_cli/test_auth_usable_secret.py
Normal file
13
tests/hermes_cli/test_auth_usable_secret.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"""Tests for placeholder API key detection in hermes_cli.auth."""
|
||||
|
||||
from hermes_cli.auth import has_usable_secret
|
||||
|
||||
|
||||
def test_has_usable_secret_rejects_documented_placeholder_key() -> None:
|
||||
"""Network-exposed API server key must reject static documentation placeholders."""
|
||||
assert not has_usable_secret("your_api_key_here", min_length=8)
|
||||
|
||||
|
||||
def test_has_usable_secret_accepts_generated_key() -> None:
|
||||
"""Random-looking keys should still be accepted."""
|
||||
assert has_usable_secret("b4d59f7fe8b857d0b367ef0f5710b6a4", min_length=8)
|
||||
|
|
@ -51,7 +51,7 @@ docker run -d \
|
|||
-p 8642:8642 \
|
||||
-e API_SERVER_ENABLED=true \
|
||||
-e API_SERVER_HOST=0.0.0.0 \
|
||||
-e API_SERVER_KEY=your_api_key_here \
|
||||
-e API_SERVER_KEY="$(openssl rand -hex 32)" \
|
||||
-e API_SERVER_CORS_ORIGINS='*' \
|
||||
nousresearch/hermes-agent gateway run
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue