Quarantine silently stores nothing when Q_EXCLUDE_DOMAINS is missing (in_array TypeError in pipe.php)

Author: mdb-ingeniaCreated Sep 27, 2026Updated Sep 27, 2026

Summary

data/conf/rspamd/meta_exporter/pipe.php dies silently (HTTP 200, nothing stored, nothing logged) when the Redis key Q_EXCLUDE_DOMAINS does not exist. Rspamd posts rejected mail to /pipe.php, nginx logs 200, but the quarantine table stays empty.

Cause

php
if ($exclude_domains = $redis->Get('Q_EXCLUDE_DOMAINS')) {
  $exclude_domains = json_decode($exclude_domains, true);
}
// ...
if (in_array($parsed_rcpt['domain'], $exclude_domains)) {

If the key is missing, Get() returns false, $exclude_domains stays false, and in_array() throws a TypeError on PHP 8. Because the script sets error_reporting to 0, the error is never logged.

Q_EXCLUDE_DOMAINS is only written when the quarantine settings are saved (quarantine('edit', ['action' => 'settings', ...])). The php-fpm docker-entrypoint.sh initializes Q_MAX_AGE but not this key. So it happens when the quarantine is enabled without saving the settings form, e.g. by setting Q_RETENTION_SIZE / Q_MAX_SIZE in Redis directly.

Steps to reproduce

  1. Fresh install; never save the quarantine settings in the UI (Q_EXCLUDE_DOMAINS does not exist).
  2. redis-cli SET Q_RETENTION_SIZE 50 and redis-cli SET Q_MAX_SIZE 15.
  3. Send a message to a local mailbox that Rspamd rejects by score (not GTUBE, which is handled before the metadata exporter).
  4. The message is rejected, /pipe.php returns 200, the quarantine stays empty, and there is no QUARANTINE: line in the php-fpm log.
  5. redis-cli SET Q_EXCLUDE_DOMAINS '[]' and repeat: the message is stored.

Suggested fix

Initialize the variable before reading the key, e.g. $exclude_domains = array();, or use $exclude_domains = json_decode($redis->Get('Q_EXCLUDE_DOMAINS') ?: '[]', true);.

Environment

  • mailcow-dockerized ca07d8d3 (2026-09, merge of #7477)
  • PHP 8.2.29 (php-fpm-mailcow), Rspamd 4.1.4

Source: mailcow/mailcow-dockerized