From 76efbe72fdd1ea391081ec90de9fc3da7e0e9905 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 3 Aug 2026 21:24:31 -0400 Subject: [PATCH] fix(docker): keep the Redis password out of the RQ worker command line The worker received its connection string through `rq worker --url`, which put the password in argv for the life of the process, readable via /proc//cmdline, ps, and any monitoring or diagnostic tooling that collects command lines (CWE-214). RQ's `--url` option already reads from RQ_REDIS_URL, so passing it through the environment instead is behavior-preserving. This matches how the RQ scheduler alongside it already takes its credentials. Co-Authored-By: Claude Opus 5 (1M context) --- docker/init_scripts/init | 7 +++++-- entrypoint.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker/init_scripts/init b/docker/init_scripts/init index a3d48a196..a1f4bb4a3 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -251,15 +251,18 @@ start_bin_rq_worker() { fi # Set PYTHONPATH so RQ can find the tasks module. + # The connection URL goes through RQ_REDIS_URL rather than --url, so the + # embedded password stays out of the worker's world-readable command line. # Use a worker class that drops the noisy per-sweep "cleaning registries for # queue" log line. The maintenance interval keeps its default (~10 min) so # orphaned STARTED jobs and stale workers are still pruned promptly, which the # watcher's Worker.all() scan dedupe relies on. - PYTHONPATH="/backend:${PYTHONPATH-}" rq worker \ + PYTHONPATH="/backend:${PYTHONPATH-}" \ + RQ_REDIS_URL="${redis_url}" \ + rq worker \ --path /backend \ --worker-class handler.rq_worker.RomMWorker \ --pid /tmp/rq_worker.pid \ - --url "${redis_url}" \ --results-ttl "${TASK_RESULT_TTL:-86400}" \ --logging_level "${LOGLEVEL}" \ high default low & diff --git a/entrypoint.sh b/entrypoint.sh index 74ecd13d5..e815271bb 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -69,15 +69,18 @@ else fi # Set PYTHONPATH so RQ can find the tasks module. +# The connection URL goes through RQ_REDIS_URL rather than --url, so the +# embedded password stays out of the worker's world-readable command line. # Use a worker class that drops the noisy per-sweep "cleaning registries for # queue" log line. The maintenance interval keeps its default (~10 min) so # orphaned STARTED jobs and stale workers are still pruned promptly, which the # watcher's Worker.all() scan dedupe relies on. -PYTHONPATH="/app/backend:${PYTHONPATH-}" rq worker \ +PYTHONPATH="/app/backend:${PYTHONPATH-}" \ + RQ_REDIS_URL="${REDIS_URL}" \ + rq worker \ --path /app/backend \ --worker-class handler.rq_worker.RomMWorker \ --pid /tmp/rq_worker.pid \ - --url "${REDIS_URL}" \ --logging_level "${LOGLEVEL:-INFO}" \ high default low &