Skip to content

Commit dd7cac6

Browse files
committed
fix(security): generate dedicated DREAM_AGENT_KEY in both installers
DREAM_AGENT_KEY was registered in .env.schema.json and preferred by the host agent, but never generated by either installer. All installations fell back to DASHBOARD_API_KEY, meaning the browser-facing dashboard key doubled as the privileged host agent credential. Now generated as a separate 32-byte hex secret alongside DASHBOARD_API_KEY. Existing installs retain their current keys on re-install (merge logic preserves values).
1 parent ac881c3 commit dd7cac6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

dream-server/installers/macos/lib/env-generator.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ generate_dream_env() {
132132
livekit_api_key=$(new_secure_hex 16)
133133
local dashboard_api_key
134134
dashboard_api_key=$(new_secure_hex 32)
135+
local dream_agent_key
136+
dream_agent_key=$(new_secure_hex 32)
135137
local openclaw_token
136138
openclaw_token=$(new_secure_hex 24)
137139
local qdrant_api_key
@@ -221,6 +223,7 @@ LANGFUSE_PORT=3006
221223
#=== Security (auto-generated, keep secret!) ===
222224
WEBUI_SECRET=${webui_secret}
223225
DASHBOARD_API_KEY=${dashboard_api_key}
226+
DREAM_AGENT_KEY=${dream_agent_key}
224227
N8N_USER=admin@dreamserver.local
225228
N8N_PASS=${n8n_pass}
226229
LITELLM_KEY=${litellm_key}

dream-server/installers/phases/06-directories.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ Fix with: sudo chown -R \$(id -u):\$(id -g) $INSTALL_DIR/config $INSTALL_DIR/dat
199199
LITELLM_KEY=$(_env_get LITELLM_KEY "sk-dream-$(openssl rand -hex 16 2>/dev/null || head -c 16 /dev/urandom | xxd -p)")
200200
LIVEKIT_SECRET=$(_env_get LIVEKIT_API_SECRET "$(openssl rand -base64 32 2>/dev/null || head -c 32 /dev/urandom | base64)")
201201
DASHBOARD_API_KEY=$(_env_get DASHBOARD_API_KEY "$(openssl rand -hex 32 2>/dev/null || head -c 32 /dev/urandom | xxd -p)")
202+
DREAM_AGENT_KEY=$(_env_get DREAM_AGENT_KEY "$(openssl rand -hex 32 2>/dev/null || head -c 32 /dev/urandom | xxd -p)")
202203
DIFY_SECRET_KEY=$(_env_get DIFY_SECRET_KEY "$(openssl rand -hex 32 2>/dev/null || head -c 32 /dev/urandom | xxd -p)")
203204
QDRANT_API_KEY=$(_env_get QDRANT_API_KEY "$(openssl rand -hex 32 2>/dev/null || head -c 32 /dev/urandom | xxd -p)")
204205
OPENCODE_SERVER_PASSWORD=$(_env_get OPENCODE_SERVER_PASSWORD "$(openssl rand -base64 16 2>/dev/null || head -c 16 /dev/urandom | base64)")
@@ -342,6 +343,7 @@ LANGFUSE_PORT=${LANGFUSE_PORT}
342343
#=== Security (auto-generated, keep secret!) ===
343344
WEBUI_SECRET=${WEBUI_SECRET}
344345
DASHBOARD_API_KEY=${DASHBOARD_API_KEY}
346+
DREAM_AGENT_KEY=${DREAM_AGENT_KEY}
345347
N8N_USER=admin@dreamserver.local
346348
N8N_PASS=${N8N_PASS}
347349
LITELLM_KEY=${LITELLM_KEY}

0 commit comments

Comments
 (0)