Skip to content

Commit

Permalink
Adding fixed code
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Schendel <[email protected]>
  • Loading branch information
amitschendel committed Jan 29, 2025
1 parent cd54b7b commit 2ecb42a
Show file tree
Hide file tree
Showing 8 changed files with 1,211 additions and 545 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/armosec/utils-k8s-go v0.0.26
github.com/containers/common v0.60.4
github.com/deckarep/golang-set/v2 v2.6.0
github.com/dghubble/trie v0.1.0
github.com/didip/tollbooth/v7 v7.0.2
github.com/go-logr/zapr v1.3.0
github.com/gogo/protobuf v1.3.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM=
github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/dghubble/trie v0.1.0 h1:kJnjBLFFElBwS60N4tkPvnLhnpcDxbBjIulgI8CpNGM=
github.com/dghubble/trie v0.1.0/go.mod h1:sOmnzfBNH7H92ow2292dDFWNsVQuh/izuD7otCYb1ak=
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4=
github.com/didip/tollbooth/v7 v7.0.2 h1:WYEfusYI6g64cN0qbZgekDrYfuYBZjUZd5+RlWi69p4=
github.com/didip/tollbooth/v7 v7.0.2/go.mod h1:RtRYfEmFGX70+ike5kSndSvLtQ3+F2EAmTI4Un/VXNc=
Expand Down
3 changes: 1 addition & 2 deletions pkg/apis/softwarecomposition/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ type StackFrame struct {

type CallStackNode struct {
Children []CallStackNode
// Parent *CallStackNode
Frame StackFrame
Frame StackFrame
}

type CallStack struct {
Expand Down
12 changes: 10 additions & 2 deletions pkg/registry/file/applicationprofile_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ func deflateApplicationProfileContainer(container softwarecomposition.Applicatio
logger.L().Debug("failed to analyze opens", loggerhelpers.Error(err))
opens = DeflateStringer(container.Opens)
}

endpoints := dynamicpathdetector.AnalyzeEndpoints(&container.Endpoints, dynamicpathdetector.NewPathAnalyzer(EndpointDynamicThreshold))
logger.L().Info("Printing before merge", loggerhelpers.Int("size", len(container.IdentifiedCallStacks)))
for _, identifiedCallStack := range container.IdentifiedCallStacks {
callstack.PrettyPrintCallStack(identifiedCallStack)
}
identifiedCallStacks := callstack.UnifyIdentifiedCallStacks(container.IdentifiedCallStacks)
logger.L().Info("Printing after merge", loggerhelpers.Int("size", len(identifiedCallStacks)))
for _, identifiedCallStack := range identifiedCallStacks {
callstack.PrettyPrintCallStack(identifiedCallStack)
}

return softwarecomposition.ApplicationProfileContainer{
Name: container.Name,
Expand All @@ -125,6 +133,6 @@ func deflateApplicationProfileContainer(container softwarecomposition.Applicatio
ImageTag: container.ImageTag,
ImageID: container.ImageID,
PolicyByRuleId: DeflateRulePolicies(container.PolicyByRuleId),
IdentifiedCallStacks: callstack.UnifyIdentifiedCallStacks(container.IdentifiedCallStacks),
IdentifiedCallStacks: identifiedCallStacks,
}
}
Loading

0 comments on commit 2ecb42a

Please sign in to comment.