From f199c1d67ed0fb96f0b4d31a1ee052c76e0c9c5a Mon Sep 17 00:00:00 2001 From: Afek Berger Date: Thu, 12 Sep 2024 17:54:22 +0300 Subject: [PATCH] Modified profile processor to detect dynamic open --- pkg/registry/file/applicationprofile_processor.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/registry/file/applicationprofile_processor.go b/pkg/registry/file/applicationprofile_processor.go index 6dd7d499..bf53eb28 100644 --- a/pkg/registry/file/applicationprofile_processor.go +++ b/pkg/registry/file/applicationprofile_processor.go @@ -54,11 +54,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...)),