Skip to content

Commit

Permalink
return the client without performing a matchRepository operation when…
Browse files Browse the repository at this point in the history
… the application'plugin be configured by its name

Signed-off-by: Javier Solana <[email protected]>
  • Loading branch information
Javier Solana committed May 2, 2024
1 parent 220dee0 commit 18ab91b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions util/app/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 18ab91b

Please sign in to comment.