diff --git a/pkg/security/secl/rules/ruleset.go b/pkg/security/secl/rules/ruleset.go index b82ddb1ad4ef29..c0be4c61468e9b 100644 --- a/pkg/security/secl/rules/ruleset.go +++ b/pkg/security/secl/rules/ruleset.go @@ -11,6 +11,7 @@ import ( "fmt" "reflect" "slices" + "strings" "sync" "github.com/spf13/cast" @@ -121,6 +122,10 @@ func (rs *RuleSet) AddMacro(parsingContext *ast.ParsingContext, pMacro *PolicyMa case pMacro.Def.Expression != "" && len(pMacro.Def.Values) > 0: return nil, &ErrMacroLoad{Macro: pMacro, Err: errors.New("only one of 'expression' and 'values' can be defined")} case pMacro.Def.Expression != "": + if strings.Contains(pMacro.Def.Expression, "fim.write.file.") { + return nil, &ErrMacroLoad{Macro: pMacro, Err: errors.New("macro expression cannot contain 'fim.write.file.' event types")} + } + if macro, err = eval.NewMacro(pMacro.Def.ID, pMacro.Def.Expression, rs.model, parsingContext, rs.evalOpts); err != nil { return nil, &ErrMacroLoad{Macro: pMacro, Err: err} }