mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-17 15:28:18 +00:00
Only have -pc/-pk apply to syscall rules (#495)
Currently, -pc/-pk results in extra fields added to the output field of all rules. They should only be added for syscall rules.
This commit is contained in:
@@ -493,24 +493,26 @@ function load_rules(sinsp_lua_parser,
|
|||||||
-- If the format string contains %container.info, replace it
|
-- If the format string contains %container.info, replace it
|
||||||
-- with extra. Otherwise, add extra onto the end of the format
|
-- with extra. Otherwise, add extra onto the end of the format
|
||||||
-- string.
|
-- string.
|
||||||
if string.find(v['output'], "%container.info", nil, true) ~= nil then
|
if v['source'] == "syscall" then
|
||||||
|
if string.find(v['output'], "%container.info", nil, true) ~= nil then
|
||||||
|
|
||||||
-- There may not be any extra, or we're not supposed
|
-- There may not be any extra, or we're not supposed
|
||||||
-- to replace it, in which case we use the generic
|
-- to replace it, in which case we use the generic
|
||||||
-- "%container.name (id=%container.id)"
|
-- "%container.name (id=%container.id)"
|
||||||
if replace_container_info == false then
|
if replace_container_info == false then
|
||||||
v['output'] = string.gsub(v['output'], "%%container.info", "%%container.name (id=%%container.id)")
|
v['output'] = string.gsub(v['output'], "%%container.info", "%%container.name (id=%%container.id)")
|
||||||
|
if extra ~= "" then
|
||||||
|
v['output'] = v['output'].." "..extra
|
||||||
|
end
|
||||||
|
else
|
||||||
|
safe_extra = string.gsub(extra, "%%", "%%%%")
|
||||||
|
v['output'] = string.gsub(v['output'], "%%container.info", safe_extra)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Just add the extra to the end
|
||||||
if extra ~= "" then
|
if extra ~= "" then
|
||||||
v['output'] = v['output'].." "..extra
|
v['output'] = v['output'].." "..extra
|
||||||
end
|
end
|
||||||
else
|
|
||||||
safe_extra = string.gsub(extra, "%%", "%%%%")
|
|
||||||
v['output'] = string.gsub(v['output'], "%%container.info", safe_extra)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- Just add the extra to the end
|
|
||||||
if extra ~= "" then
|
|
||||||
v['output'] = v['output'].." "..extra
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user