Project

General

Profile

Actions

Optimization #4753

open

lua: fix inconsistency in the init "needs" key

Added by Juliana Fajardini Reichow about 3 years ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

In Suricata, there's a difference in the usage of needs key, depending on whether one is writing a match or a log function in the lua scripts.
It is better to have the same behavior for both use cases.

Current behavior:
If one wants to use the log ability, the usage is:

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

If one wants to write a match function in Lua scripts, then it must be:

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

Real-life examples:
Example for match: https://github.com/OISF/suricata-verify/blob/master/tests/dns-lua-rules/test-rrname.lua Example for log: https://github.com/OISF/suricata-verify/blob/master/tests/lua-output-dns/test.lua

Expected behavior:
regardless of what function is being written, users should be able to use needs in the same way.


Related issues 2 (1 open1 closed)

Related to Suricata - Documentation #4725: Inconsistent "needs" key documentation for Lua functionsClosedJuliana Fajardini ReichowActions
Blocks Suricata - Story #7128: lua: sandboxed lua support with mimimum set of bindingsNewVictor JulienActions
Actions #1

Updated by Juliana Fajardini Reichow about 3 years ago

  • Related to Documentation #4725: Inconsistent "needs" key documentation for Lua functions added
Actions #2

Updated by Juliana Fajardini Reichow about 3 years ago

  • Status changed from New to In Review

PR: https://github.com/OISF/suricata/pull/6480

(this PR is actually for the documentation, not for the change in the code itself)

Actions #3

Updated by Juliana Fajardini Reichow almost 3 years ago

  • Status changed from In Review to Assigned
Actions #4

Updated by Victor Julien about 2 years ago

  • Target version changed from 7.0.0-beta1 to 8.0.0-beta1
Actions #5

Updated by Victor Julien 10 months ago

  • Assignee changed from Juliana Fajardini Reichow to OISF Dev
Actions #6

Updated by Victor Julien 10 months ago

  • Status changed from Assigned to New
  • Assignee changed from OISF Dev to Jo Johnson
Actions #7

Updated by Victor Julien 5 months ago

  • Assignee changed from Jo Johnson to Jason Ish
Actions #8

Updated by Victor Julien 5 months ago

  • Subject changed from Fix inconsistency in Lua functions for the "needs" key to lua: fix inconsistency in the init "needs" key
Actions #9

Updated by Victor Julien 5 months ago

  • Blocks Story #7128: lua: sandboxed lua support with mimimum set of bindings added
Actions

Also available in: Atom PDF