mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-27 15:17:50 +00:00
chore(userspace/engine): remove unused lua functions and state vars
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
parent
ef6888181d
commit
335d79e79c
@ -113,31 +113,6 @@ function expand_macros(ast, defs, changed)
|
|||||||
return true, changed
|
return true, changed
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_macros(ast, set)
|
|
||||||
if (ast.type == "Macro") then
|
|
||||||
set[ast.value] = true
|
|
||||||
return set
|
|
||||||
end
|
|
||||||
|
|
||||||
if ast.type == "Filter" then
|
|
||||||
return get_macros(ast.value, set)
|
|
||||||
end
|
|
||||||
|
|
||||||
if ast.type == "BinaryBoolOp" then
|
|
||||||
local left = get_macros(ast.left, {})
|
|
||||||
local right = get_macros(ast.right, {})
|
|
||||||
|
|
||||||
for m, _ in pairs(left) do set[m] = true end
|
|
||||||
for m, _ in pairs(right) do set[m] = true end
|
|
||||||
|
|
||||||
return set
|
|
||||||
end
|
|
||||||
if ast.type == "UnaryBoolOp" then
|
|
||||||
return get_macros(ast.argument, set)
|
|
||||||
end
|
|
||||||
return set
|
|
||||||
end
|
|
||||||
|
|
||||||
function get_filters(ast)
|
function get_filters(ast)
|
||||||
|
|
||||||
local filters = {}
|
local filters = {}
|
||||||
|
@ -157,17 +157,6 @@ local function create_filter_obj(node, lua_parser, parent_bool_op)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_output(output_format, state)
|
|
||||||
|
|
||||||
if(output_ast.type == "OutputFormat") then
|
|
||||||
|
|
||||||
local format
|
|
||||||
|
|
||||||
else
|
|
||||||
error ("Unexpected type in set_output: ".. output_ast.type)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This should be keep in sync with parser.lua
|
-- This should be keep in sync with parser.lua
|
||||||
defined_comp_operators = {
|
defined_comp_operators = {
|
||||||
["="]=1,
|
["="]=1,
|
||||||
@ -197,7 +186,7 @@ defined_list_comp_operators = {
|
|||||||
-- object. The by_name index is used for things like describing rules,
|
-- object. The by_name index is used for things like describing rules,
|
||||||
-- and the by_idx index is used to map the relational node index back
|
-- and the by_idx index is used to map the relational node index back
|
||||||
-- to a rule.
|
-- to a rule.
|
||||||
local state = {macros={}, lists={}, filter_ast=nil, rules_by_name={},
|
local state = {macros={}, lists={}, rules_by_name={},
|
||||||
skipped_rules_by_name={}, macros_by_name={}, lists_by_name={},
|
skipped_rules_by_name={}, macros_by_name={}, lists_by_name={},
|
||||||
n_rules=0, rules_by_idx={}, ordered_rule_names={}, ordered_macro_names={}, ordered_list_names={}}
|
n_rules=0, rules_by_idx={}, ordered_rule_names={}, ordered_macro_names={}, ordered_list_names={}}
|
||||||
|
|
||||||
@ -1067,14 +1056,6 @@ function load_rules(rules_content,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Rule ASTs are merged together into one big AST, with "OR" between each
|
|
||||||
-- rule.
|
|
||||||
if (state.filter_ast == nil) then
|
|
||||||
state.filter_ast = filter_ast.filter.value
|
|
||||||
else
|
|
||||||
state.filter_ast = { type = "BinaryBoolOp", operator = "or", left = state.filter_ast, right = filter_ast.filter.value }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Enable/disable the rule
|
-- Enable/disable the rule
|
||||||
if (v['enabled'] == nil) then
|
if (v['enabled'] == nil) then
|
||||||
v['enabled'] = true
|
v['enabled'] = true
|
||||||
|
Loading…
Reference in New Issue
Block a user