From 18ab91be361c22717e9df135af454f32933ed1d1 Mon Sep 17 00:00:00 2001 From: Javier Solana Date: Thu, 2 May 2024 10:40:05 +0200 Subject: [PATCH] return the client without performing a matchRepository operation when the application'plugin be configured by its name Signed-off-by: Javier Solana --- util/app/discovery/discovery.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/app/discovery/discovery.go b/util/app/discovery/discovery.go index b46a86ff426e3..d2cb92fd3d6ba 100644 --- a/util/app/discovery/discovery.go +++ b/util/app/discovery/discovery.go @@ -165,7 +165,12 @@ func cmpSupports(ctx context.Context, pluginSockFilePath, appPath, repoPath, fil return nil, nil, false } - isSupported, isDiscoveryEnabled, err := matchRepositoryCMP(ctx, appPath, repoPath, cmpClient, env, tarExcludedGlobs) + // if plugin name is specified, lets return the client directly + if namedPlugin { + return conn, cmpClient, true + } + + isSupported, _, err := matchRepositoryCMP(ctx, appPath, repoPath, cmpClient, env, tarExcludedGlobs) if err != nil { log.WithFields(log.Fields{ common.SecurityField: common.SecurityMedium, @@ -176,10 +181,6 @@ func cmpSupports(ctx context.Context, pluginSockFilePath, appPath, repoPath, fil } if !isSupported { - // if discovery is not set and the plugin name is specified, let app use the plugin - if !isDiscoveryEnabled && namedPlugin { - return conn, cmpClient, true - } log.WithFields(log.Fields{ common.SecurityField: common.SecurityLow, common.SecurityCWEField: common.SecurityCWEMissingReleaseOfFileDescriptor,