Skip to content

Commit

Permalink
Added rule extras (#442)
Browse files Browse the repository at this point in the history
Signed-off-by: Afek Berger <[email protected]>
  • Loading branch information
afek854 authored Dec 19, 2024
1 parent c31c78d commit 5f8a098
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func (rule *R0006UnexpectedServiceAccountTokenAccess) ProcessEvent(eventType uti
PodLabels: openEvent.K8s.PodLabels,
},
RuleID: rule.ID(),
Extra: convertedEvent.GetExtra(),
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/ruleengine/v1/r1005_fileless_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (rule *R1005FilelessExecution) handleExecveEvent(execEvent *events.ExecEven
PodLabels: execEvent.K8s.PodLabels,
},
RuleID: rule.ID(),
Extra: execEvent.GetExtra(),
}

return &ruleFailure
Expand Down
6 changes: 4 additions & 2 deletions pkg/ruleengine/v1/r1011_ld_preload_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (rule *R1011LdPreloadHook) ProcessEvent(eventType utils.EventType, event ut
return nil
}

return rule.ruleFailureOpenEvent(&openEvent.Event)
return rule.ruleFailureOpenEvent(&openEvent.Event, openEvent.GetExtra())
}

return nil
Expand Down Expand Up @@ -165,12 +165,13 @@ func (rule *R1011LdPreloadHook) ruleFailureExecEvent(execEvent *events.ExecEvent
PodLabels: execEvent.K8s.PodLabels,
},
RuleID: rule.ID(),
Extra: execEvent.GetExtra(),
}

return &ruleFailure
}

func (rule *R1011LdPreloadHook) ruleFailureOpenEvent(openEvent *traceropentype.Event) ruleengine.RuleFailure {
func (rule *R1011LdPreloadHook) ruleFailureOpenEvent(openEvent *traceropentype.Event, extra interface{}) ruleengine.RuleFailure {
ruleFailure := GenericRuleFailure{
BaseRuntimeAlert: apitypes.BaseRuntimeAlert{
AlertName: rule.Name(),
Expand Down Expand Up @@ -199,6 +200,7 @@ func (rule *R1011LdPreloadHook) ruleFailureOpenEvent(openEvent *traceropentype.E
PodLabels: openEvent.K8s.PodLabels,
},
RuleID: rule.ID(),
Extra: extra,
}

return &ruleFailure
Expand Down

0 comments on commit 5f8a098

Please sign in to comment.