Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing pointer from slices because they contain an inner pointer to… #153

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pkg/approfilecache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ func (access *ApplicationProfileAccessImpl) GetNamespace() string {
return access.appProfileNamespace
}

func (access *ApplicationProfileAccessImpl) GetExecList() (*[]collector.ExecCalls, error) {
return &access.containerProfile.Execs, nil
func (access *ApplicationProfileAccessImpl) GetExecList() ([]collector.ExecCalls, error) {
return access.containerProfile.Execs, nil
}

func (access *ApplicationProfileAccessImpl) GetOpenList() (*[]collector.OpenCalls, error) {
return &access.containerProfile.Opens, nil
func (access *ApplicationProfileAccessImpl) GetOpenList() ([]collector.OpenCalls, error) {
return access.containerProfile.Opens, nil
}

func (access *ApplicationProfileAccessImpl) GetNetworkActivity() (*collector.NetworkActivity, error) {
Expand All @@ -218,12 +218,12 @@ func (access *ApplicationProfileAccessImpl) GetSystemCalls() ([]string, error) {
return access.containerProfile.SysCalls, nil
}

func (access *ApplicationProfileAccessImpl) GetCapabilities() (*[]collector.CapabilitiesCalls, error) {
return &access.containerProfile.Capabilities, nil
func (access *ApplicationProfileAccessImpl) GetCapabilities() ([]collector.CapabilitiesCalls, error) {
return access.containerProfile.Capabilities, nil
}

func (access *ApplicationProfileAccessImpl) GetDNS() (*[]collector.DnsCalls, error) {
return &access.containerProfile.Dns, nil
func (access *ApplicationProfileAccessImpl) GetDNS() ([]collector.DnsCalls, error) {
return access.containerProfile.Dns, nil
}

func (c *ApplicationProfileK8sCache) StartController() {
Expand Down
8 changes: 4 additions & 4 deletions pkg/approfilecache/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ type SingleApplicationProfileAccess interface {
// Get application profile namespace
GetNamespace() string
// Get exec list
GetExecList() (*[]collector.ExecCalls, error)
GetExecList() ([]collector.ExecCalls, error)
// Get open list
GetOpenList() (*[]collector.OpenCalls, error)
GetOpenList() ([]collector.OpenCalls, error)
// Get network activity
GetNetworkActivity() (*collector.NetworkActivity, error)
// Get system calls
GetSystemCalls() ([]string, error)
// Get capabilities
GetCapabilities() (*[]collector.CapabilitiesCalls, error)
GetCapabilities() ([]collector.CapabilitiesCalls, error)
// Get DNS activity
GetDNS() (*[]collector.DnsCalls, error)
GetDNS() ([]collector.DnsCalls, error)
}

type ApplicationProfileCache interface {
Expand Down
16 changes: 8 additions & 8 deletions pkg/engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ func (m *MockAppProfileAccess) GetNamespace() string {
return "testProfileNamespace"
}

func (m *MockAppProfileAccess) GetExecList() (*[]collector.ExecCalls, error) {
return &m.Execs, nil
func (m *MockAppProfileAccess) GetExecList() ([]collector.ExecCalls, error) {
return m.Execs, nil
}

func (m *MockAppProfileAccess) GetOpenList() (*[]collector.OpenCalls, error) {
return &m.OpenCalls, nil
func (m *MockAppProfileAccess) GetOpenList() ([]collector.OpenCalls, error) {
return m.OpenCalls, nil
}

func (m *MockAppProfileAccess) GetNetworkActivity() (*collector.NetworkActivity, error) {
Expand All @@ -114,12 +114,12 @@ func (m *MockAppProfileAccess) GetSystemCalls() ([]string, error) {
return m.Syscalls, nil
}

func (m *MockAppProfileAccess) GetCapabilities() (*[]collector.CapabilitiesCalls, error) {
return &m.Capabilities, nil
func (m *MockAppProfileAccess) GetCapabilities() ([]collector.CapabilitiesCalls, error) {
return m.Capabilities, nil
}

func (m *MockAppProfileAccess) GetDNS() (*[]collector.DnsCalls, error) {
return &m.Dns, nil
func (m *MockAppProfileAccess) GetDNS() ([]collector.DnsCalls, error) {
return m.Dns, nil
}

// ApplicationProfileCacheMock is a mock implementation of ApplicationProfileCache.
Expand Down
16 changes: 8 additions & 8 deletions pkg/engine/rule/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ func (m *MockAppProfileAccess) GetNamespace() string {
return "testNamespace"
}

func (m *MockAppProfileAccess) GetExecList() (*[]collector.ExecCalls, error) {
return &m.Execs, nil
func (m *MockAppProfileAccess) GetExecList() ([]collector.ExecCalls, error) {
return m.Execs, nil
}

func (m *MockAppProfileAccess) GetOpenList() (*[]collector.OpenCalls, error) {
return &m.OpenCalls, nil
func (m *MockAppProfileAccess) GetOpenList() ([]collector.OpenCalls, error) {
return m.OpenCalls, nil
}

func (m *MockAppProfileAccess) GetNetworkActivity() (*collector.NetworkActivity, error) {
Expand All @@ -68,10 +68,10 @@ func (m *MockAppProfileAccess) GetSystemCalls() ([]string, error) {
return m.Syscalls, nil
}

func (m *MockAppProfileAccess) GetCapabilities() (*[]collector.CapabilitiesCalls, error) {
return &m.Capabilities, nil
func (m *MockAppProfileAccess) GetCapabilities() ([]collector.CapabilitiesCalls, error) {
return m.Capabilities, nil
}

func (m *MockAppProfileAccess) GetDNS() (*[]collector.DnsCalls, error) {
return &m.Dns, nil
func (m *MockAppProfileAccess) GetDNS() ([]collector.DnsCalls, error) {
return m.Dns, nil
}
2 changes: 1 addition & 1 deletion pkg/engine/rule/r0001_unexpected_process_launched.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (rule *R0001UnexpectedProcessLaunched) ProcessEvent(eventType tracing.Event
}
}

for _, execCall := range *appProfileExecList {
for _, execCall := range appProfileExecList {
if execCall.Path == execEvent.PathName {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/rule/r0002_unexpected_file_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (rule *R0002UnexpectedFileAccess) ProcessEvent(eventType tracing.EventType,
}
}

for _, open := range *appProfileOpenList {
for _, open := range appProfileOpenList {
if open.Path == openEvent.PathName {
found := 0
for _, eventOpenFlag := range openEvent.Flags {
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/rule/r0004_unexpected_capability_used.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (rule *R0004UnexpectedCapabilityUsed) ProcessEvent(eventType tracing.EventT
}

found := false
for _, cap := range *appProfileCapabilitiesList {
for _, cap := range appProfileCapabilitiesList {
if capEvent.Syscall == cap.Syscall {
// Check that the capability is in cap.Capabilities
for _, baselineCapability := range cap.Capabilities {
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/rule/r0005_unexpected_domain_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (rule *R0005UnexpectedDomainRequest) ProcessEvent(eventType tracing.EventTy

// Check that the domain is in the application profile
found := false
for _, domain := range *appProfileDnsList {
for _, domain := range appProfileDnsList {
if domain.DnsName == domainEvent.DnsName {
found = true
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (rule *R0006UnexpectedServiceAccountTokenAccess) ProcessEvent(eventType tra
}
}

for _, open := range *appProfileOpenList {
for _, open := range appProfileOpenList {
for _, prefix := range ServiceAccountTokenPathsPrefixs {
if strings.HasPrefix(open.Path, prefix) {
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/rule/r0007_kubernetes_client_executed.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (rule *R0007KubernetesClientExecuted) handleExecEvent(event *tracing.Execve
return nil
}

for _, whitelistedExec := range *whitelistedExecs {
for _, whitelistedExec := range whitelistedExecs {
if whitelistedExec.Path == event.PathName {
return nil
}
Expand Down
Loading