• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 23374838686

21 Mar 2026 07:29AM UTC coverage: 59.341% (-20.0%) from 79.315%
23374838686

Pull #15075

github

web-flow
Merge 90b4e834f into 6587e363a
Pull Request #15075: Stack 8001 v16.4

38 of 70 new or added lines in 10 files covered. (54.29%)

34165 existing lines in 563 files now uncovered.

119621 of 201584 relevant lines covered (59.34%)

650666.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/util-lua-builtins.c
1
/* Copyright (C) 2025 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17

18
#include "suricata-common.h"
19
#include "util-lua-builtins.h"
20
#include "util-lua-base64lib.h"
21
#include "util-lua-bytevarlib.h"
22
#include "util-lua-config.h"
23
#include "util-lua-dataset.h"
24
#include "util-lua-dnp3.h"
25
#include "util-lua-flowintlib.h"
26
#include "util-lua-flowvarlib.h"
27
#include "util-lua-http.h"
28
#include "util-lua-dns.h"
29
#include "util-lua-smtp.h"
30
#include "util-lua-ssh.h"
31
#include "util-lua-flowlib.h"
32
#include "util-lua-hashlib.h"
33
#include "util-lua-tls.h"
34
#include "util-lua-packetlib.h"
35
#include "util-lua-rule.h"
36
#include "util-lua-ja3.h"
37
#include "util-lua-filelib.h"
38
#include "util-lua-log.h"
39
#include "util-lua-util.h"
40

41
#include "lauxlib.h"
42

43
static const luaL_Reg builtins[] = {
44
    { "suricata.base64", SCLuaLoadBase64Lib },
45
    { "suricata.bytevar", LuaLoadBytevarLib },
46
    { "suricata.config", SCLuaLoadConfigLib },
47
    { "suricata.dataset", LuaLoadDatasetLib },
48
    { "suricata.dnp3", SCLuaLoadDnp3Lib },
49
    { "suricata.dns", SCLuaLoadDnsLib },
50
    { "suricata.file", SCLuaLoadFileLib },
51
    { "suricata.flow", LuaLoadFlowLib },
52
    { "suricata.flowint", LuaLoadFlowintLib },
53
    { "suricata.flowvar", LuaLoadFlowvarLib },
54
    { "suricata.hashlib", SCLuaLoadHashlib },
55
    { "suricata.http", SCLuaLoadHttpLib },
56
    { "suricata.ja3", SCLuaLoadJa3Lib },
57
    { "suricata.log", SCLuaLoadLogLib },
58
    { "suricata.packet", LuaLoadPacketLib },
59
    { "suricata.rule", SCLuaLoadRuleLib },
60
    { "suricata.smtp", SCLuaLoadSmtpLib },
61
    { "suricata.ssh", SCLuaLoadSshLib },
62
    { "suricata.tls", SCLuaLoadTlsLib },
63
    { "suricata.util", SCLuaLoadUtilLib },
64
    { NULL, NULL },
65
};
66

67
/**
68
 * \brief Load a Suricata built-in module in a sand-boxed environment.
69
 */
70
bool SCLuaLoadBuiltIns(lua_State *L, const char *name)
UNCOV
71
{
×
UNCOV
72
    for (const luaL_Reg *lib = builtins; lib->name; lib++) {
×
UNCOV
73
        if (strcmp(name, lib->name) == 0) {
×
UNCOV
74
            lib->func(L);
×
UNCOV
75
            return true;
×
UNCOV
76
        }
×
UNCOV
77
    }
×
78
    return false;
×
UNCOV
79
}
×
80

81
/**
82
 * \brief Register Suricata built-in modules for loading in a
83
 *     non-sandboxed environment.
84
 */
85
void SCLuaRequirefBuiltIns(lua_State *L)
UNCOV
86
{
×
UNCOV
87
    for (const luaL_Reg *lib = builtins; lib->name; lib++) {
×
UNCOV
88
        luaL_requiref(L, lib->name, lib->func, 0);
×
UNCOV
89
        lua_pop(L, 1);
×
UNCOV
90
    }
×
UNCOV
91
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc