Skip to content

Commit a2e4282

Browse files
fix: address security issues in documentation examples
- Replace hardcoded API key placeholders with env var references in config.yaml examples (part9) - Standardize placeholder keys to use obvious non-secret patterns (<your-key-here>) - Add security warning for unauthenticated LightRAG REST API (bind to 127.0.0.1) - Add proper cryptographic secret generation for Telegram webhook secret - Add chmod 600 guidance for .env files containing API keys - Add curl-pipe-to-bash inspection tip for install command - Replace realistic-looking Telegram bot token examples with safe placeholders Co-Authored-By: Rob <onerobby@gmail.com>
1 parent ef8034a commit a2e4282

5 files changed

Lines changed: 82 additions & 23 deletions

File tree

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ One command. That's it.
109109
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
110110
```
111111

112+
> **Security tip:** Piping scripts directly from the internet to bash executes them sight-unseen. If you prefer to inspect first:
113+
> ```bash
114+
> curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh -o install.sh
115+
> less install.sh # Review the script
116+
> bash install.sh
117+
> ```
118+
112119
> **Windows users:** Native Windows is not supported. Install [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install) and run the command from inside WSL. It works perfectly.
113120
114121
### What the Installer Does
@@ -185,8 +192,11 @@ This opens an interactive menu to add API keys for each provider. Keys are store
185192

186193
> **Tip:** You can also set keys manually:
187194
> ```bash
188-
> echo "ANTHROPIC_API_KEY=sk-ant-..." >> ~/.hermes/.env
195+
> echo "ANTHROPIC_API_KEY=<your-key-here>" >> ~/.hermes/.env
196+
> chmod 600 ~/.hermes/.env # Restrict access to your user only
189197
> ```
198+
>
199+
> **Important:** Always run `chmod 600 ~/.hermes/.env` to prevent other users on the system from reading your API keys.
190200
191201
### 3. Configure Toolsets
192202
@@ -621,18 +631,20 @@ Create `~/.hermes/lightrag/.env`:
621631
# LLM for entity extraction (during ingestion)
622632
LLM_BINDING=openai
623633
LLM_MODEL=kimi-2.5 # What we actually use — great quality/cost ratio
624-
LLM_BINDING_API_KEY=***
634+
LLM_BINDING_API_KEY=<your-api-key>
625635

626636
# Embedding model (for vector storage)
627637
EMBEDDING_BINDING=fireworks
628638
EMBEDDING_MODEL=accounts/fireworks/models/qwen3-embedding-8b
629-
EMBEDDING_API_KEY=***
639+
EMBEDDING_API_KEY=<your-fireworks-api-key>
630640

631641
# Or use local Ollama (free, no API key needed):
632642
# EMBEDDING_BINDING=ollama
633643
# EMBEDDING_MODEL=nomic-embed-text
634644
```
635645

646+
> **Security tip:** Set restrictive permissions on this file: `chmod 600 ~/.hermes/lightrag/.env`
647+
636648
### Entity Extraction Model — What to Use
637649

638650
This is the LLM that reads your documents and pulls out entities and relationships during ingestion. Quality here directly determines how good your knowledge graph is.
@@ -658,15 +670,17 @@ This is the LLM that reads your documents and pulls out entities and relationshi
658670
```bash
659671
cd ~/.hermes/lightrag/LightRAG
660672

661-
# Start the API server
662-
lightrag-server --port 9623
673+
# Start the API server (binds to localhost by default)
674+
lightrag-server --host 127.0.0.1 --port 9623
663675
```
664676

665677
The server starts on `http://localhost:9623` with:
666678
- **REST API** for ingestion and querying
667679
- **Web UI** at `http://localhost:9623/webui` for browsing the knowledge graph
668680
- **Health check** at `http://localhost:9623/health`
669681

682+
> **Security warning:** The LightRAG REST API has **no built-in authentication**. Always bind to `127.0.0.1` (localhost only) — never `0.0.0.0`. If you need remote access, put it behind a reverse proxy (nginx, Caddy) with authentication, or use SSH tunneling. Anyone who can reach this port can query, ingest, or delete your knowledge graph data.
683+
670684
### Run as a Background Service
671685

672686
```bash
@@ -1088,8 +1102,8 @@ Select **Telegram** when prompted. The wizard asks for your bot token and allowe
10881102
Add the following to `~/.hermes/.env`:
10891103

10901104
```bash
1091-
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrSTUvwxYZ
1092-
TELEGRAM_ALLOWED_USERS=123456789 # Comma-separated for multiple users
1105+
TELEGRAM_BOT_TOKEN=<your-bot-token-from-botfather>
1106+
TELEGRAM_ALLOWED_USERS=<your-numeric-user-id> # Comma-separated for multiple users
10931107
```
10941108

10951109
For groups, also add the group chat ID (negative number, like `-1001234567890`):
@@ -1173,9 +1187,19 @@ Add to `~/.hermes/.env`:
11731187

11741188
```bash
11751189
TELEGRAM_WEBHOOK_URL=https://your-app.fly.dev
1176-
TELEGRAM_WEBHOOK_SECRET=your-random-secret-here
1190+
TELEGRAM_WEBHOOK_SECRET=<generate-with-command-below>
11771191
```
11781192

1193+
Generate a strong secret — never use a guessable value:
1194+
1195+
```bash
1196+
openssl rand -hex 32
1197+
```
1198+
1199+
Copy the output and paste it as your `TELEGRAM_WEBHOOK_SECRET` value.
1200+
1201+
> **Warning:** A weak or default webhook secret lets attackers forge Telegram webhook requests and inject messages into your agent. Always use a cryptographically random value.
1202+
11791203
| | Polling (default) | Webhook |
11801204
|---|---|---|
11811205
| Direction | Gateway → Telegram | Telegram → Gateway |

part1-setup.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ One command. That's it.
1414
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
1515
```
1616

17+
> **Security tip:** Piping scripts directly from the internet to bash executes them sight-unseen. If you prefer to inspect first:
18+
> ```bash
19+
> curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh -o install.sh
20+
> less install.sh # Review the script
21+
> bash install.sh
22+
> ```
23+
1724
> **Windows users:** Native Windows is not supported. Install [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install) and run the command from inside WSL. It works perfectly.
1825
1926
### What the Installer Does
@@ -74,8 +81,11 @@ This opens an interactive menu to add API keys for each provider. Keys are store
7481

7582
> **Tip:** You can also set keys manually:
7683
> ```bash
77-
> echo "ANTHROPIC_API_KEY=sk-ant-..." >> ~/.hermes/.env
84+
> echo "ANTHROPIC_API_KEY=<your-key-here>" >> ~/.hermes/.env
85+
> chmod 600 ~/.hermes/.env # Restrict access to your user only
7886
> ```
87+
>
88+
> **Important:** Always run `chmod 600 ~/.hermes/.env` to prevent other users on the system from reading your API keys.
7989
8090
### 3. Configure Toolsets
8191

part3-lightrag-setup.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,20 @@ Create `~/.hermes/lightrag/.env`:
7272
# LLM for entity extraction (during ingestion)
7373
LLM_BINDING=openai
7474
LLM_MODEL=gpt-4.1-mini
75-
LLM_BINDING_API_KEY=sk-...
75+
LLM_BINDING_API_KEY=<your-openai-api-key>
7676

7777
# Embedding model (for vector storage)
7878
EMBEDDING_BINDING=fireworks
7979
EMBEDDING_MODEL=accounts/fireworks/models/qwen3-embedding-8b
80-
EMBEDDING_API_KEY=fw_...
80+
EMBEDDING_API_KEY=<your-fireworks-api-key>
8181

8282
# Or use local Ollama (free, no API key needed):
8383
# EMBEDDING_BINDING=ollama
8484
# EMBEDDING_MODEL=nomic-embed-text
8585
```
8686

87+
> **Security tip:** Set restrictive permissions on this file: `chmod 600 ~/.hermes/lightrag/.env`
88+
8789
> **Tip:** Use `gpt-4.1-mini` or `claude-sonnet-4-20250514` for entity extraction. It doesn't need to be your smartest model — it just needs to reliably identify entities and relationships. Cheaper models save money on ingestion.
8890
8991
> **Embedding quality matters.** If you have a GPU with 8GB+ VRAM, run `nomic-embed-text` locally via Ollama for free. If you want the best quality, use Fireworks' Qwen3-Embedding-8B (4096 dimensions) — the search accuracy difference is dramatic.
@@ -97,15 +99,17 @@ EMBEDDING_API_KEY=fw_...
9799
```bash
98100
cd ~/.hermes/lightrag/LightRAG
99101

100-
# Start the API server
101-
lightrag-server --port 9623
102+
# Start the API server (binds to localhost by default)
103+
lightrag-server --host 127.0.0.1 --port 9623
102104
```
103105

104106
The server starts on `http://localhost:9623` with:
105107
- **REST API** for ingestion and querying
106108
- **Web UI** at `http://localhost:9623/webui` for browsing the knowledge graph
107109
- **Health check** at `http://localhost:9623/health`
108110

111+
> **Security warning:** The LightRAG REST API has **no built-in authentication**. Always bind to `127.0.0.1` (localhost only) — never `0.0.0.0`. If you need remote access, put it behind a reverse proxy (nginx, Caddy) with authentication, or use SSH tunneling. Anyone who can reach this port can query, ingest, or delete your knowledge graph data.
112+
109113
### Run as a Background Service
110114

111115
```bash

part4-telegram-setup.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ Select **Telegram** when prompted. The wizard asks for your bot token and allowe
109109
Add the following to `~/.hermes/.env`:
110110

111111
```bash
112-
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrSTUvwxYZ
113-
TELEGRAM_ALLOWED_USERS=123456789 # Comma-separated for multiple users
112+
TELEGRAM_BOT_TOKEN=<your-bot-token-from-botfather>
113+
TELEGRAM_ALLOWED_USERS=<your-numeric-user-id> # Comma-separated for multiple users
114114
```
115115

116+
> **Security tip:** After editing, run `chmod 600 ~/.hermes/.env` to restrict file access to your user only.
117+
116118
For groups, also add the group chat ID (negative number, like `-1001234567890`):
117119

118120
```bash
@@ -194,9 +196,19 @@ Add to `~/.hermes/.env`:
194196

195197
```bash
196198
TELEGRAM_WEBHOOK_URL=https://your-app.fly.dev
197-
TELEGRAM_WEBHOOK_SECRET=your-random-secret-here
199+
TELEGRAM_WEBHOOK_SECRET=<generate-with-command-below>
198200
```
199201

202+
Generate a strong secret — never use a guessable value:
203+
204+
```bash
205+
openssl rand -hex 32
206+
```
207+
208+
Copy the output and paste it as your `TELEGRAM_WEBHOOK_SECRET` value.
209+
210+
> **Warning:** A weak or default webhook secret lets attackers forge Telegram webhook requests and inject messages into your agent. Always use a cryptographically random value.
211+
200212
| | Polling (default) | Webhook |
201213
|---|---|---|
202214
| Direction | Gateway → Telegram | Telegram → Gateway |

part9-custom-models.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
Models are configured in `~/.hermes/config.yaml`:
1010

11+
> **Security note:** Never put real API keys directly in `config.yaml`. Use environment variable references so keys stay in `~/.hermes/.env` (which should be `chmod 600` and never committed to git).
12+
1113
```yaml
1214
# Default model
1315
model: claude-sonnet-4-20250514
@@ -16,22 +18,22 @@ provider: anthropic
1618
# Provider configurations
1719
providers:
1820
anthropic:
19-
api_key: sk-ant-...
21+
api_key: ${ANTHROPIC_API_KEY}
2022

2123
openai:
22-
api_key: sk-...
24+
api_key: ${OPENAI_API_KEY}
2325

2426
cerebras:
25-
api_key: csk-...
27+
api_key: ${CEREBRAS_API_KEY}
2628
base_url: https://api.cerebras.ai/v1
2729

2830
fireworks:
29-
api_key: fw_...
31+
api_key: ${FIREWORKS_API_KEY}
3032
base_url: https://api.fireworks.ai/inference/v1
3133

3234
local:
3335
base_url: http://localhost:11434/v1
34-
api_key: ollama
36+
api_key: ollama # Ollama doesn't require a real key
3537
```
3638
3739
## Adding a Custom Provider
@@ -41,10 +43,17 @@ Any provider that implements the OpenAI chat completions API works:
4143
```yaml
4244
providers:
4345
my-custom:
44-
api_key: your-key-here
46+
api_key: ${MY_CUSTOM_API_KEY}
4547
base_url: https://api.your-provider.com/v1
4648
```
4749
50+
Add the actual key to your `.env` file:
51+
52+
```bash
53+
echo "MY_CUSTOM_API_KEY=<your-key-here>" >> ~/.hermes/.env
54+
chmod 600 ~/.hermes/.env
55+
```
56+
4857
Then use it:
4958

5059
```bash
@@ -102,7 +111,7 @@ Config:
102111
```yaml
103112
providers:
104113
cerebras:
105-
api_key: csk-your-key
114+
api_key: ${CEREBRAS_API_KEY}
106115
base_url: https://api.cerebras.ai/v1
107116
# Models: llama-3.3-70b, llama-4-scout-17b-16e-instruct, qwen-3-32b
108117
```

0 commit comments

Comments
 (0)