Project

General

Profile

Actions

Documentation #4725

closed

Inconsistent "needs" key documentation for Lua functions

Added by Sascha Steinbiss about 1 year ago. Updated about 5 hours ago.

Status:
Closed
Priority:
Low
Target version:
Affected Versions:
Effort:
Difficulty:
low
Label:

Description

I noticed that some example code in the Lua functions documentation does not really match reality. For example, using

function init (args)
    local needs = {}
    needs["protocol"] = "tls" 
    return needs
end

in a Lua detection script (according to https://suricata.readthedocs.io/en/latest/lua/lua-functions.html#tls) only gives me

[30573] 30/9/2021 -- 13:27:13 - (detect-lua.c:969) <Error> (DetectLuaSetupPrime) -- [ERRCODE: SC_ERR_LUA_ERROR(212)] - unsupported data type protocol

while, after looking at https://github.com/OISF/suricata/blob/master/src/detect-lua.c#L944 it became clear that

function init (args)
    local needs = {}
    needs["tls"] = "true" 
    return needs
end

would be correct. Perhaps it could make sense to check the documentation to ensure that examples are working.


Related issues 1 (1 open0 closed)

Related to Optimization #4753: Fix inconsistency in Lua functions for the "needs" keyAssignedJuliana Fajardini ReichowActions
Actions #1

Updated by Victor Julien about 1 year ago

  • Assignee set to Juliana Fajardini Reichow
Actions #2

Updated by Juliana Fajardini Reichow about 1 year ago

  • Status changed from New to In Progress
Actions #3

Updated by Juliana Fajardini Reichow about 1 year ago

  • Related to Optimization #4753: Fix inconsistency in Lua functions for the "needs" key added
Actions #4

Updated by Juliana Fajardini Reichow about 1 year ago

  • Status changed from In Progress to In Review
Actions #5

Updated by Juliana Fajardini Reichow about 1 year ago

  • Status changed from In Review to Closed
Actions #6

Updated by Juliana Fajardini Reichow about 5 hours ago

  • Target version set to 7.0.0
Actions

Also available in: Atom PDF