Project

General

Profile

Actions

Bug #9215

closed
JI VJ

luaxform: report runtime and return-value errors

Bug #9215: luaxform: report runtime and return-value errors

Added by Jason Ish about 1 month ago. Updated 8 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

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:

function transform(input, args)
    error("transform failed")
end

Expected behavior and acceptance criteria

  • Increment transform.lua.errors for 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.


Subtasks 1 (0 open — 1 closed)

Bug #9338: luaxform: report runtime and return-value errors (8.0.x backport)ClosedVictor JulienActions

JI Updated by Jason Ish about 1 month ago Actions #1

  • 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 Actions #2

MR1382

JI Updated by Jason Ish 27 days ago Actions #3

  • Subtask #9338 added

JI Updated by Jason Ish 26 days ago Actions #4

  • Status changed from In Review to Closed

JI Updated by Jason Ish 8 days ago Actions #5

  • Private changed from Yes to No
Actions

Also available in: PDF Atom