Bug #9215
closedluaxform: report runtime and return-value errors
Description
When a luaxform script fails, Suricata leaves the input buffer unchanged and reports the failure only through debug logging. There are no transform error counters or warnings available during normal operation.
This makes runtime exceptions, sandbox limit failures, and invalid return values difficult to diagnose. Inspection continues using the original buffer, which may produce unexpected rule results without explaining why the transformation failed.
For example, a rule using this transform should produce a visible error:
Expected behavior and acceptance criteria¶
- Increment
transform.lua.errorsfor every failed transformation. - Additionally increment the appropriate counter for instruction limits, memory limits, or blocked functions.
- Emit a warning identifying the script and failure, with repeated warnings limited per thread, script, and error category.
- Preserve the input buffer on failure.
- Detect missing or invalid return lengths before interpreting them as zero.
- Cover runtime exceptions, sandbox failures, malformed returns, and valid empty output with regression tests. Malformed-return tests should include a buffer with previously allocated transform storage.
Proposed fix¶
4c91d0f70f54b3db30b5bdc30a9ff4120d3435ef. The reviewed patch needs corrections to aggregate error counting and return-length validation before it satisfies these criteria.
Related issues¶
#6939 and #6940 added analogous handling for Lua detection rules. #9049 covers the separate out-of-bounds read caused by unchecked transform return lengths.
JI Updated by Jason Ish about 1 month ago
- Status changed from New to In Review
- Assignee set to Victor Julien
MR1382.
@Victor Julien, does this match your findings?
JI Updated by Jason Ish about 1 month ago
MR1382