Hermes Agent commited on
Commit
ec2b16b
·
1 Parent(s): 800c52a

Enforce strict secret separation: keep STORAGE_ENCRYPTION_KEY and secrets in memory/HF Space Secrets and purge server.env from storage bucket

Browse files
Files changed (1) hide show
  1. entrypoint.sh +3 -14
entrypoint.sh CHANGED
@@ -31,7 +31,7 @@ for _ENV_FILE in \
31
  done
32
  unset _ENV_FILE
33
 
34
- # Ensure deterministic, permanent secrets and persist to /data/omniroute/server.env
35
  export STORAGE_ENCRYPTION_KEY="${STORAGE_ENCRYPTION_KEY:-$(echo "opencode_storage_encryption_key_2026" | sha256sum | cut -c1-64)}"
36
  export JWT_SECRET="${JWT_SECRET:-$(echo "opencode_jwt_secret_hf_space_key_2026" | sha256sum | cut -c1-48)}"
37
  export API_KEY_SECRET="${API_KEY_SECRET:-$(echo "opencode_api_key_secret_hf_space_key_2026" | sha256sum | cut -c1-64)}"
@@ -40,19 +40,8 @@ export WEBUI_SECRET_KEY="${WEBUI_SECRET_KEY:-$(echo "owui_${JWT_SECRET}" | sha25
40
  export ENCRYPTION_SECRET="${ENCRYPTION_SECRET:-${STORAGE_ENCRYPTION_KEY}}"
41
  export OMNIROUTE_SECRET_KEY="${OMNIROUTE_SECRET_KEY:-${STORAGE_ENCRYPTION_KEY}}"
42
 
43
- mkdir -p /data/omniroute 2>/dev/null || true
44
- if [ ! -f "/data/omniroute/server.env" ]; then
45
- echo "[INIT] Persisting permanent encryption secrets to /data/omniroute/server.env..."
46
- cat <<EOF > /data/omniroute/server.env
47
- STORAGE_ENCRYPTION_KEY="${STORAGE_ENCRYPTION_KEY}"
48
- JWT_SECRET="${JWT_SECRET}"
49
- API_KEY_SECRET="${API_KEY_SECRET}"
50
- OMNIROUTE_WS_BRIDGE_SECRET="${OMNIROUTE_WS_BRIDGE_SECRET}"
51
- WEBUI_SECRET_KEY="${WEBUI_SECRET_KEY}"
52
- ENCRYPTION_SECRET="${ENCRYPTION_SECRET}"
53
- OMNIROUTE_SECRET_KEY="${OMNIROUTE_SECRET_KEY}"
54
- EOF
55
- fi
56
 
57
  # Debug: show secret statuses
58
  for _VAR in STORAGE_ENCRYPTION_KEY JWT_SECRET API_KEY_SECRET OMNIROUTE_WS_BRIDGE_SECRET WEBUI_SECRET_KEY; do
 
31
  done
32
  unset _ENV_FILE
33
 
34
+ # Ensure deterministic, permanent secrets in container environment
35
  export STORAGE_ENCRYPTION_KEY="${STORAGE_ENCRYPTION_KEY:-$(echo "opencode_storage_encryption_key_2026" | sha256sum | cut -c1-64)}"
36
  export JWT_SECRET="${JWT_SECRET:-$(echo "opencode_jwt_secret_hf_space_key_2026" | sha256sum | cut -c1-48)}"
37
  export API_KEY_SECRET="${API_KEY_SECRET:-$(echo "opencode_api_key_secret_hf_space_key_2026" | sha256sum | cut -c1-64)}"
 
40
  export ENCRYPTION_SECRET="${ENCRYPTION_SECRET:-${STORAGE_ENCRYPTION_KEY}}"
41
  export OMNIROUTE_SECRET_KEY="${OMNIROUTE_SECRET_KEY:-${STORAGE_ENCRYPTION_KEY}}"
42
 
43
+ # Remove legacy server.env from storage bucket to maintain strict secret separation
44
+ rm -f /data/omniroute/server.env 2>/dev/null || true
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  # Debug: show secret statuses
47
  for _VAR in STORAGE_ENCRYPTION_KEY JWT_SECRET API_KEY_SECRET OMNIROUTE_WS_BRIDGE_SECRET WEBUI_SECRET_KEY; do