Skip to content

Commit

Permalink
Merge pull request #162 from kubescape/empty
Browse files Browse the repository at this point in the history
skip exec events with empty path
  • Loading branch information
matthyx authored Dec 21, 2023
2 parents 85abd9b + 19d637b commit 2d895fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ func (am *ApplicationProfileManager) ReportCapability(k8sContainerID, capability
}

func (am *ApplicationProfileManager) ReportFileExec(k8sContainerID, path string, args []string) {
// skip empty path
if path == "" {
return
}
execMap := am.execSets.Get(k8sContainerID)
if execMap.Has(path) {
execMap.Get(path).Append(args...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestApplicationProfileManager(t *testing.T) {
// report capability
am.ReportCapability("ns/pod/cont", "NET_BIND_SERVICE")
// report file exec
am.ReportFileExec("ns/pod/cont", "", []string{"ls"})
am.ReportFileExec("ns/pod/cont", "/bin/bash", []string{"-c", "ls"})
// report file open
am.ReportFileOpen("ns/pod/cont", "/etc/passwd", []string{"O_RDONLY"})
Expand Down

0 comments on commit 2d895fc

Please sign in to comment.