Skip to content

Commit

Permalink
Modified profile processor to detect dynamic open
Browse files Browse the repository at this point in the history
  • Loading branch information
afek854 committed Sep 17, 2024
1 parent 749f806 commit b259e93
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/registry/file/applicationprofile_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,24 @@ func (a ApplicationProfileProcessor) PreSave(object runtime.Object) error {
}

func deflateApplicationProfileContainer(container softwarecomposition.ApplicationProfileContainer) softwarecomposition.ApplicationProfileContainer {
opens := deflateStringer(container.Opens)

opens, err := dynamicpathdetector.AnalyzeOpens(opens, dynamicpathdetector.NewPathAnalyzer(OpenDynamicThreshold))
if err != nil {
logger.L().Warning("failed to analyze opens", loggerhelpers.Error(err))
opens = deflateStringer(container.Opens)
}

if opens == nil {
opens = []softwarecomposition.OpenCalls{}
}

endpoints, err := dynamicpathdetector.AnalyzeEndpoints(&container.Endpoints, dynamicpathdetector.NewPathAnalyzer(100))
if err != nil {
logger.L().Warning("failed to analyze endpoints", loggerhelpers.Error(err))
endpoints = container.Endpoints
}

return softwarecomposition.ApplicationProfileContainer{
Name: container.Name,
Capabilities: mapset.Sorted(mapset.NewThreadUnsafeSet(container.Capabilities...)),
Expand Down

0 comments on commit b259e93

Please sign in to comment.