]> git.ipfire.org Git - thirdparty/rspamd.git/log
thirdparty/rspamd.git
3 weeks ago[Feature] Add extra tables API for clickhouse plugin 5810/head
Vsevolod Stakhov [Wed, 31 Dec 2025 10:54:55 +0000 (10:54 +0000)] 
[Feature] Add extra tables API for clickhouse plugin

Allow other plugins to dynamically register custom Clickhouse tables
via rspamd_plugins['clickhouse'].register_extra_table(). Supports
per-table schemas, row callbacks (single or multiple rows), and
independent retention settings.

3 weeks agoRevert "[Fix] Use exact map lookup for DKIM key_table instead of glob"
Vsevolod Stakhov [Wed, 31 Dec 2025 11:21:10 +0000 (11:21 +0000)] 
Revert "[Fix] Use exact map lookup for DKIM key_table instead of glob"

This reverts commit 0dadf30f5f52b3a89a859dfdc947954bff612e8c.

3 weeks ago[Fix] Use exact map lookup for DKIM key_table instead of glob
Vsevolod Stakhov [Wed, 31 Dec 2025 09:46:31 +0000 (09:46 +0000)] 
[Fix] Use exact map lookup for DKIM key_table instead of glob

Fixes #5806 - key_table was using glob matching which caused
prefix collisions (e.g., 'bvv' matching 'bvvvolley')

3 weeks ago[Fix] Add Homebrew LLVM libc++ library path on macOS
Vsevolod Stakhov [Tue, 30 Dec 2025 11:09:18 +0000 (11:09 +0000)] 
[Fix] Add Homebrew LLVM libc++ library path on macOS

3 weeks agoMerge pull request #5809 from rspamd/revert-5793-lua54
Vsevolod Stakhov [Tue, 30 Dec 2025 11:23:15 +0000 (11:23 +0000)] 
Merge pull request #5809 from rspamd/revert-5793-lua54

Revert "Use PUC-Rio Lua in packages"

3 weeks agoRevert "Use PUC-Rio Lua in packages" 5809/head
Vsevolod Stakhov [Tue, 30 Dec 2025 09:47:39 +0000 (09:47 +0000)] 
Revert "Use PUC-Rio Lua in packages"

3 weeks ago[Fix] Fix replxx build with LLVM 21+
Vsevolod Stakhov [Mon, 29 Dec 2025 22:28:40 +0000 (22:28 +0000)] 
[Fix] Fix replxx build with LLVM 21+

- Simplify CMakeLists.txt to use CMAKE_CXX_STANDARD 20
- Replace std::unordered_map with std::map to avoid libc++ ABI issues
- Add operator< to UnicodeString for std::map compatibility

3 weeks ago[Project] Update fmt library to 12.1.0
Vsevolod Stakhov [Mon, 29 Dec 2025 22:13:25 +0000 (22:13 +0000)] 
[Project] Update fmt library to 12.1.0

Also restore doctest/scripts/version.txt removed in previous commit.

3 weeks ago[Project] Remove documentation files from contrib dependencies
Vsevolod Stakhov [Mon, 29 Dec 2025 18:22:57 +0000 (18:22 +0000)] 
[Project] Remove documentation files from contrib dependencies

Keep only essential files: sources, headers, build system, and licenses.

3 weeks ago[Fix] Avoid SDK headers in include path when package ROOT is specified
Vsevolod Stakhov [Sun, 28 Dec 2025 21:20:12 +0000 (21:20 +0000)] 
[Fix] Avoid SDK headers in include path when package ROOT is specified

- Add NO_DEFAULT_PATH to FIND_PATH when PKG_ROOT is set to prevent
  macOS SDK C headers from polluting include paths before libc++
- Fix typo: {RSPAMD_DEFAULT_INCLUDE_PATHS} -> ${...}
- Remove obsolete paths (/opt/csw, /sw), add /opt/homebrew for macOS

3 weeks ago[Feature] Rename fuzzy_check max_score to hits_limit for clarity
Vsevolod Stakhov [Sun, 28 Dec 2025 18:45:05 +0000 (18:45 +0000)] 
[Feature] Rename fuzzy_check max_score to hits_limit for clarity

The option name max_score was confusing as it doesn't refer to the
symbol score but rather the number of fuzzy hash hits at which the
normalized score reaches ~1.0 (formula: tanh(e * hits / hits_limit)).

- Rename max_score -> hits_limit in fuzzy_check.c and default config
- Add backward compatibility: max_score is still accepted as an alias
- Add lua_cfg_transform to handle legacy configs (max_score overrides
  hits_limit to ensure local.d overrides work correctly)
- Add explanatory comments in config and documentation

4 weeks ago[Fix] Add resilience to lua_cfg_transform
Vsevolod Stakhov [Sat, 27 Dec 2025 10:59:05 +0000 (10:59 +0000)] 
[Fix] Add resilience to lua_cfg_transform

- Check :type() before indexing UCL objects to handle null values
- Wrap transform sections in pcall to prevent one bad config section
  from breaking the entire configuration load
- Log errors with section name for easier debugging

4 weeks ago[Fix] Load rbl_common early for confighelp schema registration
Vsevolod Stakhov [Thu, 25 Dec 2025 15:37:37 +0000 (15:37 +0000)] 
[Fix] Load rbl_common early for confighelp schema registration

Move require of plugins/rbl before confighelp check so the schema
gets registered even in confighelp mode.

4 weeks ago[Feature] Add confighelp documentation for RBL module
Vsevolod Stakhov [Thu, 25 Dec 2025 15:26:07 +0000 (15:26 +0000)] 
[Feature] Add confighelp documentation for RBL module

Add schema documentation for all RBL rule and plugin options.
Register schemas with plugin registry for rspamadm confighelp.

4 weeks ago[Fix] Preserve doc from optional wrappers in lua_shape
Vsevolod Stakhov [Thu, 25 Dec 2025 15:24:19 +0000 (15:24 +0000)] 
[Fix] Preserve doc from optional wrappers in lua_shape

When a schema field uses :optional():doc(), the documentation was lost
during table field normalization. Now propagates doc to inner schema.

4 weeks ago[Fix] Add null checks for task in Redis stat callbacks
Vsevolod Stakhov [Thu, 25 Dec 2025 11:24:13 +0000 (11:24 +0000)] 
[Fix] Add null checks for task in Redis stat callbacks

Prevent crash when task becomes invalid during async Redis
callbacks by checking lua_check_task return value.

4 weeks ago[Fix] More lua_settop fixes in MIME processing
Vsevolod Stakhov [Tue, 23 Dec 2025 11:15:21 +0000 (11:15 +0000)] 
[Fix] More lua_settop fixes in MIME processing

Fix additional lua_settop(L, 0) calls in rspamd_message_from_data
and rspamd_mime_expr_process that could corrupt the Lua stack.

4 weeks ago[Fix] Restore Lua stack properly in second-pass MIME detection
Vsevolod Stakhov [Tue, 23 Dec 2025 10:13:43 +0000 (10:13 +0000)] 
[Fix] Restore Lua stack properly in second-pass MIME detection

Fix lua_settop(L, 0) which cleared the entire Lua stack instead
of restoring to the previous state, causing segfaults when
process_message() was called from Lua unit tests.

4 weeks agoMerge pull request #5803 from rspamd/vstakhov-task-registry
Vsevolod Stakhov [Mon, 22 Dec 2025 18:50:11 +0000 (18:50 +0000)] 
Merge pull request #5803 from rspamd/vstakhov-task-registry

[Feature] Add task registry for safe Lua task reference validation

4 weeks agoMerge pull request #5804 from fatalbanana/rspamadm_timeouts
Vsevolod Stakhov [Mon, 22 Dec 2025 18:49:29 +0000 (18:49 +0000)] 
Merge pull request #5804 from fatalbanana/rspamadm_timeouts

[Test] Set timeout for rspamadm functional tests

4 weeks agoMerge pull request #5805 from fatalbanana/fix_confighelp
Vsevolod Stakhov [Mon, 22 Dec 2025 18:49:12 +0000 (18:49 +0000)] 
Merge pull request #5805 from fatalbanana/fix_confighelp

[Minor] confighelp: Lua compatibility, remove bogus elements

4 weeks ago[Minor] confighelp: Lua compatibility, remove bogus elements 5805/head
Andrew Lewis [Mon, 22 Dec 2025 16:26:07 +0000 (18:26 +0200)] 
[Minor] confighelp: Lua compatibility, remove bogus elements

4 weeks ago[Test] Set timeout for rspamadm functional tests 5804/head
Andrew Lewis [Mon, 22 Dec 2025 15:26:06 +0000 (17:26 +0200)] 
[Test] Set timeout for rspamadm functional tests

4 weeks ago[Fix] Use Fibonacci hashing for task pointer hash 5803/head
Vsevolod Stakhov [Mon, 22 Dec 2025 11:53:37 +0000 (11:53 +0000)] 
[Fix] Use Fibonacci hashing for task pointer hash

Use golden ratio multiplication for 64-bit to 32-bit pointer hashing.
This provides good distribution with minimal operations (1 multiply +
1 shift) and works well with kh_int_hash_func which is identity.

4 weeks ago[Fix] Add logging, preallocation and hash mixing to task registry
Vsevolod Stakhov [Mon, 22 Dec 2025 11:25:49 +0000 (11:25 +0000)] 
[Fix] Add logging, preallocation and hash mixing to task registry

- Log error when detecting use-after-free attempt on task pointer
- Preallocate task set to 16 elements to reduce early rehashing
- Mix pointer bits using multiplicative hash for better distribution

4 weeks ago[Fix] Use pointer set instead of key map for task validation
Vsevolod Stakhov [Mon, 22 Dec 2025 10:06:19 +0000 (10:06 +0000)] 
[Fix] Use pointer set instead of key map for task validation

Store task pointers in a khash set and validate them on lookup
from Lua. This works with all code paths that create task userdata
directly without going through rspamd_lua_task_push.

4 weeks ago[Fix] Use rspamd_lua_task_push in all task creation paths
Vsevolod Stakhov [Sun, 21 Dec 2025 22:23:36 +0000 (22:23 +0000)] 
[Fix] Use rspamd_lua_task_push in all task creation paths

Fix load_from_file, load_from_string, and create to use
rspamd_lua_task_push instead of directly creating userdata
with raw task pointer.

4 weeks ago[Feature] Add task registry for safe Lua task reference validation
Vsevolod Stakhov [Sun, 21 Dec 2025 20:05:27 +0000 (20:05 +0000)] 
[Feature] Add task registry for safe Lua task reference validation

Implement a global task registry that maps unique uint64_t keys to task
pointers. This prevents use-after-free bugs when Lua code holds references
to tasks that may have been freed (e.g., in async Redis callbacks).

Key changes:
- Add lua_key field to rspamd_task struct
- Implement task registry using khash (O(1) lookup)
- Store lua_key in Lua userdata instead of raw pointer
- Lookup via registry when extracting task from Lua
- Remove task from registry FIRST in rspamd_task_free()

The counter-based key approach avoids issues with:
- Pointer reuse after free (memory allocator may reuse addresses)
- Lua number precision (52-bit mantissa is sufficient for counter)
- NaN/subnormal float values that could cause issues

This fixes potential use-after-free in Redis script waitq callbacks
when Redis is unavailable longer than task lifetime.

5 weeks agoRevert "[Fix] Prevent use-after-free in Redis callbacks after session cleanup"
Vsevolod Stakhov [Fri, 19 Dec 2025 12:28:28 +0000 (12:28 +0000)] 
Revert "[Fix] Prevent use-after-free in Redis callbacks after session cleanup"

This reverts commit 99ba65fc30685e613c138dc1f68acdc51732f86f.

5 weeks agoRevert "[Fix] Release Redis connection in lua_redis_fin to avoid double-free"
Vsevolod Stakhov [Fri, 19 Dec 2025 12:28:12 +0000 (12:28 +0000)] 
Revert "[Fix] Release Redis connection in lua_redis_fin to avoid double-free"

This reverts commit b8de1b2542dedf8ab92a51e74b6f2a27c8d70e7b.

5 weeks ago[Minor] Greylist: improve debug logging
Vsevolod Stakhov [Fri, 19 Dec 2025 12:27:53 +0000 (12:27 +0000)] 
[Minor] Greylist: improve debug logging

5 weeks ago[Fix] Release Redis connection in lua_redis_fin to avoid double-free
Vsevolod Stakhov [Fri, 19 Dec 2025 09:39:59 +0000 (09:39 +0000)] 
[Fix] Release Redis connection in lua_redis_fin to avoid double-free

Also set ud->ctx = NULL so lua_redis_dtor won't try to release again
during Lua GC after the pool may have been destroyed.

5 weeks ago[Fix] Prevent use-after-free in Redis callbacks after session cleanup
Vsevolod Stakhov [Thu, 18 Dec 2025 16:13:23 +0000 (16:13 +0000)] 
[Fix] Prevent use-after-free in Redis callbacks after session cleanup

Set ud->terminated in lua_redis_fin() so async Redis callbacks
don't access task data after the task pool has been freed.

5 weeks agoMerge pull request #5762 from rspamd/vstakhov-pdf-text
Vsevolod Stakhov [Wed, 17 Dec 2025 11:47:12 +0000 (11:47 +0000)] 
Merge pull request #5762 from rspamd/vstakhov-pdf-text

[Feature] Implement basic PDF text extraction

5 weeks agoMerge pull request #5792 from fatalbanana/python_compat
Vsevolod Stakhov [Wed, 17 Dec 2025 10:19:25 +0000 (10:19 +0000)] 
Merge pull request #5792 from fatalbanana/python_compat

[Test] Add hacks for backwards-compatibility

5 weeks ago[Fix] Move safety valve check to collect functions
Vsevolod Stakhov [Tue, 16 Dec 2025 12:02:25 +0000 (12:02 +0000)] 
[Fix] Move safety valve check to collect functions

Check limits when adding new rows, not in periodic sender.

5 weeks ago[Fix] Add safety valve to discard data on 10x limit overflow
Vsevolod Stakhov [Tue, 16 Dec 2025 11:29:13 +0000 (11:29 +0000)] 
[Fix] Add safety valve to discard data on 10x limit overflow

Prevents unbounded memory growth by discarding buffered data when
limits are exceeded by 10x, logging an error to alert operators.

5 weeks ago[Fix] Fix Lua 5.4 compatibility in clickhouse and elastic plugins
Vsevolod Stakhov [Tue, 16 Dec 2025 11:25:29 +0000 (11:25 +0000)] 
[Fix] Fix Lua 5.4 compatibility in clickhouse and elastic plugins

- Merge nested settings tables (limits, retention) to preserve defaults
  when user provides partial configuration
- Use %d with math.floor() instead of %.0f for integer formatting

5 weeks ago[Fix] Use %.0f format specifier for floats in clickhouse plugin
Vsevolod Stakhov [Mon, 15 Dec 2025 17:19:01 +0000 (17:19 +0000)] 
[Fix] Use %.0f format specifier for floats in clickhouse plugin

Lua 5.4 string.format is stricter than LuaJIT and requires %d to receive
actual integers. Use %.0f for timestamp differences which are floats.

5 weeks agoMerge pull request #5795 from moisseev/playwright
Vsevolod Stakhov [Mon, 15 Dec 2025 16:05:46 +0000 (16:05 +0000)] 
Merge pull request #5795 from moisseev/playwright

[Test] Add WebUI symbol ordering tests

5 weeks agoMerge pull request #5797 from moisseev/webui
Vsevolod Stakhov [Mon, 15 Dec 2025 16:05:30 +0000 (16:05 +0000)] 
Merge pull request #5797 from moisseev/webui

Improve WebUI code quality and async handling

5 weeks ago[Fix] Plain lua bails about bad format strings and do abort
Vsevolod Stakhov [Mon, 15 Dec 2025 14:11:33 +0000 (14:11 +0000)] 
[Fix] Plain lua bails about bad format strings and do abort

5 weeks ago[Fix] Fix get_text_quality bugs and clean up verbose comments 5762/head
Vsevolod Stakhov [Mon, 15 Dec 2025 12:25:56 +0000 (12:25 +0000)] 
[Fix] Fix get_text_quality bugs and clean up verbose comments

Fix two bugs in lua_util_get_text_quality:
- Pass valid UErrorCode pointer to uscript_getScript() (was returning -1)
- Move emoji check after digit check (0-9 have UCHAR_EMOJI property)

Clean up verbose comments in pdf.lua config and ligature handling.

6 weeks ago[Minor] Refactor switch statements to object lookups 5797/head
Alexander Moisseev [Sat, 13 Dec 2025 10:40:01 +0000 (13:40 +0300)] 
[Minor] Refactor switch statements to object lookups

6 weeks ago[Minor] Use expanded.ft.row instead of expand.ft.row
Alexander Moisseev [Sat, 13 Dec 2025 07:22:48 +0000 (10:22 +0300)] 
[Minor] Use expanded.ft.row instead of expand.ft.row

The expanded event fires after row expansion is complete,
eliminating the need for the artificial 5ms delay.

6 weeks ago[Fix] Handle connection errors with io_uring backend in HTTP client
Vsevolod Stakhov [Fri, 12 Dec 2025 20:24:26 +0000 (20:24 +0000)] 
[Fix] Handle connection errors with io_uring backend in HTTP client

When using io_uring, POLLERR is reported as both EV_READ and EV_WRITE.
This caused connection failures (e.g., ECONNREFUSED) to be misinterpreted
as early server responses. Check SO_ERROR before attempting to read when
the connection hasn't been established yet.

6 weeks ago[Minor] Return promise from destroyTable
Alexander Moisseev [Fri, 12 Dec 2025 17:08:11 +0000 (20:08 +0300)] 
[Minor] Return promise from destroyTable

Make destroyTable return FooTable's destruction promise
and use promise chaining instead of arbitrary timeout

6 weeks ago[Minor] Refactor retry loop into FooTable event
Alexander Moisseev [Fri, 12 Dec 2025 15:29:46 +0000 (18:29 +0300)] 
[Minor] Refactor retry loop into FooTable event

Use postinit.ft.table event instead of polling

6 weeks ago[Minor] Refactor sessionStorage Credentials handling
Alexander Moisseev [Fri, 12 Dec 2025 08:13:37 +0000 (11:13 +0300)] 
[Minor] Refactor sessionStorage Credentials handling

to use ES2020 optional chaining

6 weeks ago[Test] Skip unnecessary waiting in initial scan counter read 5795/head
Alexander Moisseev [Thu, 11 Dec 2025 18:28:54 +0000 (21:28 +0300)] 
[Test] Skip unnecessary waiting in initial scan counter read

Since the test starts already on the Status tab, the gotoTab("status")
doesn't trigger a new request, and we're just waiting for
the autorefresh to happen, causing unnecessary delay.

6 weeks ago[Feature] Add text quality analysis for PDF garbage filtering
Vsevolod Stakhov [Thu, 11 Dec 2025 18:11:36 +0000 (18:11 +0000)] 
[Feature] Add text quality analysis for PDF garbage filtering

- Add rspamd_util.get_text_quality() function with comprehensive UTF-8
  text analysis using ICU for proper Unicode classification
- Returns 18 metrics: letters, digits, punctuation, spaces, printable,
  words, word_chars, total, emojis, uppercase, lowercase, ascii_chars,
  non_ascii_chars, latin_vowels, latin_consonants, script_transitions,
  double_spaces, non_printable
- Add confidence scoring to PDF text extraction to filter garbage tokens
  (single characters, encoded data, random sequences)
- Configurable via text_quality_threshold, text_quality_min_length,
  text_quality_enabled options in pdf module config
- Add unit tests for get_text_quality function

6 weeks ago[Test] Add WebUI symbol ordering tests
Alexander Moisseev [Thu, 11 Dec 2025 17:44:47 +0000 (20:44 +0300)] 
[Test] Add WebUI symbol ordering tests

6 weeks ago[Test] Add hacks for backwards-compatibility 5792/head
Andrew Lewis [Thu, 11 Dec 2025 11:43:41 +0000 (13:43 +0200)] 
[Test] Add hacks for backwards-compatibility

6 weeks agoMerge pull request #5793 from fatalbanana/lua54
Vsevolod Stakhov [Thu, 11 Dec 2025 12:46:59 +0000 (12:46 +0000)] 
Merge pull request #5793 from fatalbanana/lua54

Use PUC-Rio Lua in packages

6 weeks ago[Minor] Clean up code style and fix Lua portability
Vsevolod Stakhov [Thu, 11 Dec 2025 12:24:53 +0000 (12:24 +0000)] 
[Minor] Clean up code style and fix Lua portability

6 weeks ago[Minor] Unbreak build on focal 5793/head
Andrew Lewis [Thu, 11 Dec 2025 12:21:14 +0000 (14:21 +0200)] 
[Minor] Unbreak build on focal

6 weeks agoMerge branch 'master' into vstakhov-pdf-text
Vsevolod Stakhov [Thu, 11 Dec 2025 11:45:49 +0000 (11:45 +0000)] 
Merge branch 'master' into vstakhov-pdf-text

6 weeks agoMerge pull request #5791 from moisseev/webui
Vsevolod Stakhov [Thu, 11 Dec 2025 11:45:37 +0000 (11:45 +0000)] 
Merge pull request #5791 from moisseev/webui

[Fix] Correct symbols column index in history and scan tables

6 weeks ago[Minor] Update version
Vsevolod Stakhov [Thu, 11 Dec 2025 11:44:26 +0000 (11:44 +0000)] 
[Minor] Update version

6 weeks ago[Fix] Correct symbols column index in history and scan tables 5791/head
Alexander Moisseev [Thu, 11 Dec 2025 08:49:38 +0000 (11:49 +0300)] 
[Fix] Correct symbols column index in history and scan tables

Fixes regression introduced in 62b136a where sorting fails with
"can't access property 'sortValue', val.options is undefined" on
the History tab, and symbol reordering doesn't work on the Scan tab.

The "file" column addition shifted the symbols column index, but
history.js and upload.js were not updated, causing symbol reordering
to target wrong columns.

Issue: #5789

6 weeks agoRelease 3.14.2 3.14.2
Vsevolod Stakhov [Wed, 10 Dec 2025 18:23:29 +0000 (18:23 +0000)] 
Release 3.14.2

Features:
- DMARC: Add --recheck-rua option for RUA filtering at send time
- Metadata exporter: Add multipart and msgpack formatters
- Milter headers: Add remove_ar_from option for selective A-R removal

Fixes:
- Security: Backport security fixes from libucl 0.9.3
- HTTP: Handle early server responses during request write
- MIME: Prevent splitting UTF-8 sequences in header encoding
- URL: Normalize URLs with multiple slashes between host and path
- Aliases: Enable plugin by default to restore plus-addressing
- Multiple Lua 5.4 compatibility fixes
- Build: FreeBSD 15 inotify compatibility
- Build: Remove deprecated OpenSSL engine.h include
- Various plugin fixes (DCC, Neural, Reputation, Milter headers)

6 weeks agoMerge pull request #5787 from rspamd/vstakhov-meta-exporter-http-rework
Vsevolod Stakhov [Wed, 10 Dec 2025 10:40:23 +0000 (10:40 +0000)] 
Merge pull request #5787 from rspamd/vstakhov-meta-exporter-http-rework

[Feature] Add multipart and msgpack formatters to metadata_exporter

6 weeks ago[Feature] Add multipart and msgpack formatters to metadata_exporter 5787/head
Vsevolod Stakhov [Tue, 9 Dec 2025 13:36:54 +0000 (13:36 +0000)] 
[Feature] Add multipart and msgpack formatters to metadata_exporter

- Add multipart formatter for HTTP export using form-data with separate
  metadata (JSON) and message (rfc822) parts
- Add msgpack formatter for efficient binary serialization
- Add json_with_message formatter for JSON with base64-encoded message
- Deprecate meta_headers option (broken by design for complex data)
- HTTP pusher now auto-detects multipart boundary from formatter

6 weeks ago[Fix] Backport security fixes from libucl 0.9.3
Vsevolod Stakhov [Tue, 9 Dec 2025 20:03:55 +0000 (20:03 +0000)] 
[Fix] Backport security fixes from libucl 0.9.3

Backported critical fixes from upstream libucl:
- Fix heap-buffer-overflow in ucl_parse_multiline_string
- Fix heap-buffer-overflow in ucl_maybe_parse_number
- Fix Use-After-Free in ucl_parser_process_object_element
- Fix C-style comment parser bugs
- Fix invalid JSON emission when merging objects
- Add API misuse detection in ucl_object_emit_streamline_start_container

6 weeks ago[Fix] Prevent splitting UTF-8 sequences in MIME header encoding
Vsevolod Stakhov [Tue, 9 Dec 2025 12:28:16 +0000 (12:28 +0000)] 
[Fix] Prevent splitting UTF-8 sequences in MIME header encoding

6 weeks agoMerge pull request #5785 from rspamd/vstakhov-http-race-fix
Vsevolod Stakhov [Tue, 9 Dec 2025 10:18:21 +0000 (10:18 +0000)] 
Merge pull request #5785 from rspamd/vstakhov-http-race-fix

[Fix] Handle HTTP early server responses during request write

6 weeks ago[Fix] Only apply early response handling for HTTP clients 5785/head
Vsevolod Stakhov [Mon, 8 Dec 2025 22:04:03 +0000 (22:04 +0000)] 
[Fix] Only apply early response handling for HTTP clients

The early response detection logic should not run for server-side
connections, as it incorrectly modifies wr_pos state when the server
reads incoming requests. This was breaking spamc protocol handling.

6 weeks ago[Fix] Handle HTTP early server responses during request write
Vsevolod Stakhov [Mon, 8 Dec 2025 17:21:03 +0000 (17:21 +0000)] 
[Fix] Handle HTTP early server responses during request write

Fix HTTP client to properly handle early server responses (e.g., 413
Too Large) that arrive before the client has finished sending the
request body. This is allowed by HTTP/1.1 (RFC 7230 Section 6.5).

- Use bitwise AND for event flag checks to handle combined EV_READ|EV_WRITE
- Watch for both READ and WRITE events during write phase
- Check for early response on write errors (EPIPE, ECONNRESET)
- Add RSPAMD_HTTP_CONN_FLAG_EARLY_RESPONSE flag to track state

6 weeks agoMerge pull request #5784 from rspamd/vstakhov-ar-removal-improvements
Vsevolod Stakhov [Mon, 8 Dec 2025 11:20:22 +0000 (11:20 +0000)] 
Merge pull request #5784 from rspamd/vstakhov-ar-removal-improvements

Add remove_ar_from option for selective AR header removal

6 weeks ago[Fix] Fix hierarchical domain matching in remove_ar_from map lookups 5784/head
Vsevolod Stakhov [Mon, 8 Dec 2025 10:22:12 +0000 (10:22 +0000)] 
[Fix] Fix hierarchical domain matching in remove_ar_from map lookups

6 weeks ago[Feature] Add remove_ar_from option for selective Authentication-Results header removal
Vsevolod Stakhov [Mon, 8 Dec 2025 09:10:46 +0000 (09:10 +0000)] 
[Feature] Add remove_ar_from option for selective Authentication-Results header removal

6 weeks agoMerge pull request #5783 from moisseev/patch-contrib
Vsevolod Stakhov [Mon, 8 Dec 2025 08:51:23 +0000 (08:51 +0000)] 
Merge pull request #5783 from moisseev/patch-contrib

[Fix] FreeBSD 15 inotify build compatibility

6 weeks ago[Fix] FreeBSD 15 inotify build compatibility 5783/head
Alexander Moisseev [Mon, 8 Dec 2025 08:02:08 +0000 (11:02 +0300)] 
[Fix] FreeBSD 15 inotify build compatibility

FreeBSD 15.0 introduced native inotify support, which causes
libev to enable EV_USE_INOTIFY. On FreeBSD, struct statfs is
defined in <sys/mount.h> rather than <sys/statfs.h>.

Note: This fix obsoletes the corresponding patch file in the
FreeBSD `mail/rspamd` and `mail/rspamd-devel` ports.

6 weeks ago[Fix] Handle nil opts in DCC plugin initialization
Vsevolod Stakhov [Sun, 7 Dec 2025 16:00:20 +0000 (16:00 +0000)] 
[Fix] Handle nil opts in DCC plugin initialization

Fixes #5751: The plugin crashed when configured with only 'enabled = false'
because get_all_opt returns nil for empty/disabled config sections.

6 weeks ago[Fix] Allow default_headers_order to be configured in milter_headers
Vsevolod Stakhov [Sun, 7 Dec 2025 15:05:13 +0000 (15:05 +0000)] 
[Fix] Allow default_headers_order to be configured in milter_headers

Fixes #5781: The default_headers_order setting was defined in the plugin
but never read from the configuration file. Add schema validation and
config loading for this option.

6 weeks ago[Fix] Fix other places of 5.4 rounding issues
Vsevolod Stakhov [Sun, 7 Dec 2025 15:00:05 +0000 (15:00 +0000)] 
[Fix] Fix other places of 5.4 rounding issues

7 weeks ago[Fix] Fix Lua 5.4 compatibility issues in neural plugin
Vsevolod Stakhov [Sat, 6 Dec 2025 18:30:09 +0000 (18:30 +0000)] 
[Fix] Fix Lua 5.4 compatibility issues in neural plugin

This commit addresses several Lua 5.4 compatibility issues that caused
the neural LLM tests to fail:

1. Redis TTL must be integer (lua_cache.lua):
   - Lua 5.4's tostring() produces "4.0" for floats instead of "4"
   - Redis SETEX/EXPIRE commands require integer TTL values
   - Fixed by using math.floor() before tostring()

2. Version number format in ANN keys (lualib/plugins/neural.lua):
   - Changed string format from %s to %d for version numbers
   - Ensures integer format "1" instead of potential "1.0"

3. Iterator vs table handling (src/plugins/lua/neural.lua):
   - fun.map() returns an iterator, not a table
   - In Lua 5.4, # operator on iterators returns 0
   - Fixed by wrapping with fun.totable() to get a proper table

4. Nil values in table arguments (lualib/plugins/neural.lua):
   - Lua 5.4 handles nil values in tables differently
   - Tables like {a, b, nil, nil} have undefined length behavior
   - Fixed by using empty string defaults for optional parameters

5. Redis script nil checks (neural_save_unlock.lua):
   - Added empty string checks alongside nil checks
   - Ensures optional fields are only set when truly provided

6. Test infrastructure improvements:
   - Added logging to dummy_llm.py for debugging
   - Added proper error handling and diagnostics
   - Updated rspamd.robot with better dummy_llm startup logging

7 weeks ago[Test] Fix TCP tests for HTTP/1.1 compliance
Vsevolod Stakhov [Sat, 6 Dec 2025 14:44:34 +0000 (14:44 +0000)] 
[Test] Fix TCP tests for HTTP/1.1 compliance

- Add required Host header to all HTTP/1.1 requests in tcp.lua
- Bind dummy servers to 127.0.0.1 instead of localhost to avoid
  IPv6/IPv4 mismatch on systems where localhost resolves to ::1

7 weeks ago[Fix] Handle Lua 5.4 require returning two values
Vsevolod Stakhov [Sat, 6 Dec 2025 14:18:20 +0000 (14:18 +0000)] 
[Fix] Handle Lua 5.4 require returning two values

Lua 5.4's require() returns both the module and the file path, while
LuaJIT returns only the module. Save stack top before luaL_dostring
and restore to top+1 after to keep only the first return value.

7 weeks ago[Fix] Use ipairs for ordered iteration in header checks
Vsevolod Stakhov [Sat, 6 Dec 2025 14:00:31 +0000 (14:00 +0000)] 
[Fix] Use ipairs for ordered iteration in header checks

pairs() does not guarantee iteration order for numeric keys. In Lua 5.4
this caused RCVD_COUNT, HAS_X_PRIO, and RCPT_COUNT symbols to select
wrong thresholds when the table was iterated in non-ascending order.

7 weeks ago[Fix] Use math.floor for Lua 5.4 integer division compatibility
Vsevolod Stakhov [Sat, 6 Dec 2025 13:42:00 +0000 (13:42 +0000)] 
[Fix] Use math.floor for Lua 5.4 integer division compatibility

In Lua 5.4, the / operator always returns a float (2/2 = 1.0), while
LuaJIT returns an integer (2/2 = 1). This caused test dependency
registration to fail as tostring(i/2) produced "1.0" instead of "1".

7 weeks ago[Fix] Improve loadstring error handling for Lua 5.4 compatibility
Vsevolod Stakhov [Sat, 6 Dec 2025 11:09:03 +0000 (11:09 +0000)] 
[Fix] Improve loadstring error handling for Lua 5.4 compatibility

Ensure loadstring results are checked for nil (syntax errors) before
passing to pcall. This prevents errors when running with Lua 5.4
compatibility where load behavior differs slightly or when handling
invalid Lua chunks.

7 weeks ago[Fix] Use userdata __gc for UCL objects in all Lua versions
Vsevolod Stakhov [Sat, 6 Dec 2025 10:03:01 +0000 (10:03 +0000)] 
[Fix] Use userdata __gc for UCL objects in all Lua versions

Use userdata __gc instead of table __gc for UCL object garbage
collection in all Lua versions. Table __gc in Lua 5.2+ can cause
use-after-free crashes due to GC ordering issues when UCL objects
reference each other or config objects.

7 weeks ago[Fix] Use locale-independent patterns in URL encoding
Vsevolod Stakhov [Sat, 6 Dec 2025 09:51:14 +0000 (09:51 +0000)] 
[Fix] Use locale-independent patterns in URL encoding

Replace %w with explicit A-Za-z0-9 ranges in URL encoding functions.
The %w pattern is locale-dependent and incorrectly matches high bytes
(0xE4, 0xE5, 0xE6) as word characters in UTF-8 locales like en_GB.UTF-8,
breaking URL encoding of non-ASCII characters.

7 weeks ago[Test] Add diagnostic logging to dummy_http.py
Vsevolod Stakhov [Sat, 6 Dec 2025 09:37:32 +0000 (09:37 +0000)] 
[Test] Add diagnostic logging to dummy_http.py

- Add startup progress messages to stderr
- Capture exceptions with full traceback
- Write PID only after successful server start
- Log output on failure in robot tests

7 weeks ago[Test] Fix Python 3.12+ compatibility in dummy_http.py
Vsevolod Stakhov [Sat, 6 Dec 2025 09:02:13 +0000 (09:02 +0000)] 
[Test] Fix Python 3.12+ compatibility in dummy_http.py

Replace deprecated asyncio.get_event_loop() with asyncio.run() to fix functional test failures on Fedora with newer Python.

7 weeks ago[Test] Fix selector tests to work with both LuaJIT and Lua 5.4
Vsevolod Stakhov [Sat, 6 Dec 2025 08:49:57 +0000 (08:49 +0000)] 
[Test] Fix selector tests to work with both LuaJIT and Lua 5.4

Use tostring() for expected values so they match the runtime's
float-to-string conversion (LuaJIT: "1", Lua 5.4: "1.0")

7 weeks ago[Test] Fix additional Lua 5.4 compatibility issues in fuzz tests
Vsevolod Stakhov [Sat, 6 Dec 2025 08:47:32 +0000 (08:47 +0000)] 
[Test] Fix additional Lua 5.4 compatibility issues in fuzz tests

- base32.lua: Add cdata_to_number helper for size_t conversion
- rfc2047.lua: Use math.floor for string.sub indices (Lua 5.4 requires integers)

7 weeks ago[Test] Fix Lua 5.4 and cffi-lua compatibility issues
Vsevolod Stakhov [Fri, 5 Dec 2025 20:43:20 +0000 (20:43 +0000)] 
[Test] Fix Lua 5.4 and cffi-lua compatibility issues

- Fix rspamd_memspn to handle empty character set without crash
- Add unpack compatibility shim for Lua 5.2+ (table.unpack)
- Replace deprecated table.maxn with # operator
- Fix cffi-lua strict type checking (char* vs unsigned char*)
- Add helpers for cdata-to-number conversion (64-bit integers)
- Add proper NULL pointer detection for cffi-lua
- Fix lua_resume to use coroutine threads in Lua 5.4
- Update test expectations for Lua 5.4 tostring(float) behavior

7 weeks ago[Test] Fix cffi-lua compatibility issues
Vsevolod Stakhov [Fri, 5 Dec 2025 17:27:55 +0000 (17:27 +0000)] 
[Test] Fix cffi-lua compatibility issues

- base32: Use tostring() for size_t values in format strings
- expressions: Use %s instead of %d for float values (Lua 5.4 strict)
- fpconv: Skip variadic function tests on cffi-lua (not supported)

7 weeks ago[Test] Fix FFI string-to-pointer conversions for cffi-lua
Vsevolod Stakhov [Fri, 5 Dec 2025 17:22:22 +0000 (17:22 +0000)] 
[Test] Fix FFI string-to-pointer conversions for cffi-lua

cffi-lua is stricter than LuaJIT FFI and requires explicit conversion
of Lua strings to C pointers. Use ffi.new/ffi.copy for the conversion.

7 weeks ago[CI] Fix cffi-lua install prefix to /usr/lib64
Vsevolod Stakhov [Fri, 5 Dec 2025 17:13:22 +0000 (17:13 +0000)] 
[CI] Fix cffi-lua install prefix to /usr/lib64

7 weeks ago[CI] Build cffi-lua from source to avoid clock skew
Vsevolod Stakhov [Fri, 5 Dec 2025 17:09:05 +0000 (17:09 +0000)] 
[CI] Build cffi-lua from source to avoid clock skew

Luarocks install fails due to clock skew in CI containers.
Build from source with touch to fix file timestamps.

7 weeks ago[CI] Add meson to cffi-lua build dependencies
Vsevolod Stakhov [Fri, 5 Dec 2025 17:03:31 +0000 (17:03 +0000)] 
[CI] Add meson to cffi-lua build dependencies

7 weeks ago[CI] Install luarocks and dependencies for cffi-lua
Vsevolod Stakhov [Fri, 5 Dec 2025 16:58:33 +0000 (16:58 +0000)] 
[CI] Install luarocks and dependencies for cffi-lua

The Fedora CI image doesn't have luarocks pre-installed, so we need
to install it along with lua-devel and libffi-devel before we can
install cffi-lua via luarocks.

7 weeks ago[Test] Use size ranges for gzip tests to support zlib-ng
Vsevolod Stakhov [Fri, 5 Dec 2025 16:31:16 +0000 (16:31 +0000)] 
[Test] Use size ranges for gzip tests to support zlib-ng

Fedora 40+ uses zlib-ng which produces slightly different compressed
sizes than standard zlib. Instead of checking exact sizes, use
reasonable ranges that accommodate both implementations.

7 weeks ago[Test] Support cffi-lua as FFI fallback for Lua 5.4
Vsevolod Stakhov [Fri, 5 Dec 2025 16:18:20 +0000 (16:18 +0000)] 
[Test] Support cffi-lua as FFI fallback for Lua 5.4

Unit tests now try LuaJIT's ffi first, falling back to cffi-lua for
standard Lua 5.4. CI installs cffi-lua via luarocks for Fedora builds.

7 weeks ago[Fix] Remove deprecated OpenSSL engine.h include
Vsevolod Stakhov [Fri, 5 Dec 2025 14:32:37 +0000 (14:32 +0000)] 
[Fix] Remove deprecated OpenSSL engine.h include

OpenSSL ENGINE API was deprecated in 3.0 and the header is removed
in newer versions. In dkim.c it was unused; in ssl_util.c we now
conditionally include it only for OpenSSL versions that need it.

7 weeks ago[CI] Use Lua 5.4 for Fedora, LuaJIT for Ubuntu
Vsevolod Stakhov [Fri, 5 Dec 2025 11:31:40 +0000 (11:31 +0000)] 
[CI] Use Lua 5.4 for Fedora, LuaJIT for Ubuntu

This ensures we test both Lua implementations in CI:
- Fedora: Lua 5.4 (ENABLE_LUAJIT=OFF)
- Ubuntu: LuaJIT (ENABLE_LUAJIT=ON, default)

7 weeks ago[Fix] Fix reputation whitelist schema and selector-aware checking
Vsevolod Stakhov [Fri, 5 Dec 2025 11:13:47 +0000 (11:13 +0000)] 
[Fix] Fix reputation whitelist schema and selector-aware checking

- lua_maps_expressions.schema: Change rules from array to key-value
  table to match actual UCL config format (fixes #5780)
- reputation.lua: Make simple whitelist maps selector-aware instead
  of always assuming IP-based whitelists

Closes #5780