]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] upstream consumers: make NULL/nil branches sound 6008/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 25 Apr 2026 19:22:22 +0000 (20:22 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 25 Apr 2026 19:22:22 +0000 (20:22 +0100)
commit254ac8ee0eff8fe79803564fe95e1f191ed2ad8a
treee8fd5258ce1a7aec9be9a59832d8610da554066d
parent9a7e47e607943f366cd1be714e678522f3400a95
[Fix] upstream consumers: make NULL/nil branches sound

A NULL guard is only useful if the branch behind it logs the failure,
propagates it correctly to the caller, and leaves internal state
consistent. Re-audited every NULL/nil-upstream branch (pre-existing
and newly added by this branch) and tightened the silent or
state-corrupting ones:

* fuzzy_backend_redis: the three rspamd_upstream_get NULL branches in
  read / count / version paths invoked the caller's callback with an
  empty result and returned silently. Admins had no signal that fuzzy
  was being skipped because every backend was dead or pending DNS.
  Each branch now also msg_err_redis_session's the reason.

* libserver/http_connection.c: when ctx->http_proxies is configured
  but every proxy upstream is unavailable, the code silently fell
  back to a direct connection - a security/privacy footgun for
  configs that meant to force traffic through a proxy. Added an
  msg_info to surface the fallback so the admin notices.

* lua_redis prepare_redis_call: the previous patch in this branch
  marked skipped servers as "tempfail" but did not insert a
  placeholder into `options`, so the load_script_task /
  load_script_taskless consumer loop's iteration index no longer
  matched the original servers_ready index. A successful upload to
  one server would then write "done" into the wrong slot of
  servers_ready (the slot for a different, possibly skipped server),
  corrupting the script-load state machine. Insert a `{ skip = true,
  upstream = s }` placeholder so the indexes stay aligned, and skip
  the placeholder in both consumer loops.
lualib/lua_redis.lua
src/libserver/fuzzy_backend/fuzzy_backend_redis.c
src/libserver/http/http_connection.c