From 4833acf046d7d80e0721847b2964e6825e5a6c4d Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 23 May 2026 02:26:14 -0700 Subject: [PATCH] fix(egress): silence CodeQL clear-text-logging on bws warning strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bws helper's warnings list contains non-secret status messages ('rate limited', 'project not found', etc.), but CodeQL's taint analyzer can't distinguish those from the secrets dict returned by the same call. Log the count instead of the strings — the warnings are still observable via 'hermes secrets bitwarden status'. --- agent/proxy_sources/iron_proxy.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/agent/proxy_sources/iron_proxy.py b/agent/proxy_sources/iron_proxy.py index 212bf64806f..dd864b6b3cf 100644 --- a/agent/proxy_sources/iron_proxy.py +++ b/agent/proxy_sources/iron_proxy.py @@ -1382,13 +1382,26 @@ def _build_proxy_subprocess_env( for n in needed: if n in secrets: env[n] = secrets[n] - for w in warnings: - logger.warning("Bitwarden refresh: %s", w) + # bws warnings are non-secret status messages (e.g. "no + # project found", "rate limited"), but the taint analyzer + # can't tell that — log the count and let the operator + # rerun under verbose if they need detail. + if warnings: + logger.warning( + "Bitwarden refresh produced %d warning(s); " + "run `hermes secrets bitwarden status` for detail.", + len(warnings), + ) else: + # NOTE: deliberately do not interpolate access_token_name + # in the log message — CodeQL's taint analyzer treats + # bitwarden_config values as secret-tainted (it can't + # distinguish the env-var NAME from the env-var VALUE). + # The name is non-secret but logging it just trips the + # check for no real benefit. logger.warning( - "credential_source=bitwarden but access_token_env=%s or " + "credential_source=bitwarden but access-token env or " "project_id is empty — proxy will fall back to parent env", - access_token_name, ) except (ImportError, RuntimeError) as exc: logger.warning(