Skip to content

Commit 3248041

Browse files
jkyberneeesclaude
andcommitted
fix(docker): prevent SearXNG fatal exit on ultrasecretkey sentinel
The pinned SearXNG (2026.6.8) treats the "ultrasecretkey" secret_key as fatal in production mode (sys.exit(1)), not a warning. When .env omits SEARXNG_SECRET, the compose `:-ultrasecretkey` fallback crashed the sidecar on startup. Switch the fallback and settings.yml default to a non-sentinel internal default (instance is internal-only, single trusted consumer) so it boots reliably; users still override for exposed setups. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1102d43 commit 3248041

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

docker/.env.example

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ GIT_COMMITTER_EMAIL=you@example.com
7979
# The compose file runs a private SearXNG instance backing the `web_search`
8080
# tool. SearXNG reads this as server.secret_key at app load and it overrides
8181
# settings.yml. Set a strong random secret (e.g. `openssl rand -hex 32`). The
82-
# instance is internal-only (no host port) but set it anyway — left unset,
83-
# SearXNG runs with the "ultrasecretkey" sentinel and logs a warning.
82+
# instance is internal-only (no host port); if you leave SEARXNG_SECRET unset,
83+
# compose falls back to a static internal default so the sidecar still boots.
84+
# Do NOT set it to the literal "ultrasecretkey" — in production mode SearXNG
85+
# treats that sentinel as fatal and the worker exits on startup.
8486
SEARXNG_SECRET=change-me-run-openssl-rand-hex-32

docker/docker-compose.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,13 @@ services:
137137
environment:
138138
- SEARXNG_BASE_URL=http://searxng:8080/
139139
# SearXNG reads server.secret_key from this env var at app load, overriding
140-
# settings.yml. Set SEARXNG_SECRET in .env. The fallback is the canonical
141-
# "ultrasecretkey" sentinel so an unset secret triggers SearXNG's own
142-
# "secret_key is not changed" warning rather than a silent weak literal.
143-
- SEARXNG_SECRET=${SEARXNG_SECRET:-ultrasecretkey}
140+
# settings.yml. Set SEARXNG_SECRET in .env. The fallback must NOT be the
141+
# "ultrasecretkey" sentinel: in production (non-debug) mode SearXNG treats
142+
# that literal as FATAL — it logs "secret_key is not changed" and calls
143+
# sys.exit(1), so the worker dies and the container never serves. This
144+
# internal-only instance (no host port, single trusted consumer) is fine
145+
# with a static default; override it in .env for any exposed deployment.
146+
- SEARXNG_SECRET=${SEARXNG_SECRET:-odek-searxng-internal-default-override-in-env}
144147
volumes:
145148
- ./searxng/settings.yml:/etc/searxng/settings.yml:ro
146149
# SearXNG needs outbound internet to query upstream engines (Google, Bing,

docker/searxng/settings.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ general:
2121
server:
2222
# SearXNG reads server.secret_key from the SEARXNG_SECRET env var at app load
2323
# (searx/settings_defaults.py: environ_name='SEARXNG_SECRET'), which overrides
24-
# this value — set SEARXNG_SECRET in .env. Keep this as the canonical
25-
# "ultrasecretkey" placeholder so that, if SEARXNG_SECRET is ever left unset,
26-
# SearXNG logs its built-in "secret_key is not changed" warning instead of
27-
# silently running with a custom-but-weak literal.
28-
secret_key: "ultrasecretkey"
24+
# this value — set SEARXNG_SECRET in .env. This must NOT be the literal
25+
# "ultrasecretkey": in production (non-debug) mode SearXNG treats that sentinel
26+
# as fatal (logs "secret_key is not changed" and exits the worker), so a
27+
# missing env override would crash startup. This is a private, internal-only
28+
# instance (single trusted consumer), so a static default is acceptable.
29+
secret_key: "odek-searxng-internal-default-override-in-env"
2930
bind_address: "0.0.0.0"
3031
port: 8080
3132
# Single trusted consumer on a private network — disable the bot limiter

0 commit comments

Comments
 (0)