Skip to content

Commit 93373e9

Browse files
committed
XRAY-144809 - Fixed maven to consider plugin deps during jf ca
1 parent bea4fa0 commit 93373e9

8 files changed

Lines changed: 633 additions & 9 deletions

File tree

cli/docs/flags.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ const (
164164
IncludeCachedPackages = "include-cached-packages"
165165
LegacyPeerDeps = "legacy-peer-deps"
166166
RunNative = "run-native"
167+
MvnIncludePluginDeps = "mvn-include-plugin-deps"
167168

168169
// Unique git flags
169170
gitPrefix = "git-"
@@ -227,7 +228,7 @@ var commandFlags = map[string][]string{
227228
StaticSca, XrayLibPluginBinaryCustomPath, AnalyzerManagerCustomPath, AddSastRules,
228229
},
229230
CurationAudit: {
230-
CurationOutput, WorkingDirs, Threads, RequirementsFile, InsecureTls, useWrapperAudit, UseIncludedBuilds, SolutionPath, DockerImageName, IncludeCachedPackages, LegacyPeerDeps, RunNative,
231+
CurationOutput, WorkingDirs, Threads, RequirementsFile, InsecureTls, useWrapperAudit, UseIncludedBuilds, SolutionPath, DockerImageName, IncludeCachedPackages, MvnIncludePluginDeps, LegacyPeerDeps, RunNative,
231232
},
232233
GitCountContributors: {
233234
InputFile, ScmType, ScmApiUrl, Token, Owner, RepoName, Months, DetailedSummary, InsecureTls, GitThreads, CacheValidity,
@@ -350,6 +351,7 @@ var flagsMap = map[string]components.Flag{
350351
CurationOutput: components.NewStringFlag(OutputFormat, "Defines the output format of the command. Acceptable values are: table, json.", components.WithStrDefaultValue("table")),
351352
SolutionPath: components.NewStringFlag(SolutionPath, "Path to the .NET solution file (.sln) to use when multiple solution files are present in the directory."),
352353
IncludeCachedPackages: components.NewBoolFlag(IncludeCachedPackages, "When set to true, the system will audit cached packages. This configuration is mandatory for Curation on-demand workflows, which rely on package caching."),
354+
MvnIncludePluginDeps: components.NewBoolFlag(MvnIncludePluginDeps, "[Maven] When set to true, Maven build-plugin transitive dependencies are included in the curation evaluation. Requires two additional Maven invocations (help:effective-pom, dependency:resolve-plugins) which may slow down the scan. By default only project dependencies are scanned."),
353355
LegacyPeerDeps: components.NewBoolFlag(LegacyPeerDeps, "[npm] Pass --legacy-peer-deps to npm install to bypass peer-dependency version conflicts."),
354356
RunNative: components.NewBoolFlag(RunNative, "[npm] Use the native npm client for dependency resolution. Reads Artifactory URL and repository from the project's .npmrc registry — no 'jf npm-config' required. Respects .npmrc and Volta configuration."),
355357
binarySca: components.NewBoolFlag(Sca, fmt.Sprintf("Selective scanners mode: Execute SCA (Software Composition Analysis) sub-scan. Use --%s to run both SCA and Contextual Analysis. Use --%s --%s to to run SCA. Can be combined with --%s.", Sca, Sca, WithoutCA, Secrets)),

cli/scancommands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ func getCurationCommand(c *components.Context) (*curation.CurationAuditCommand,
739739
SetSolutionFilePath(c.GetStringFlagValue(flags.SolutionPath))
740740
curationAuditCommand.SetDockerImageName(c.GetStringFlagValue(flags.DockerImageName))
741741
curationAuditCommand.SetIncludeCachedPackages(c.GetBoolFlagValue(flags.IncludeCachedPackages))
742+
curationAuditCommand.SetMvnIncludePluginDeps(c.GetBoolFlagValue(flags.MvnIncludePluginDeps))
742743
curationAuditCommand.SetLegacyPeerDeps(c.GetBoolFlagValue(flags.LegacyPeerDeps))
743744
curationAuditCommand.SetRunNative(c.GetBoolFlagValue(flags.RunNative))
744745
return curationAuditCommand, nil

commands/curation/curationaudit.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ type CurationAuditCommand struct {
233233
parallelRequests int
234234
dockerImageName string
235235
includeCachedPackages bool
236+
mvnIncludePluginDeps bool
236237
audit.AuditParamsInterface
237238
}
238239

@@ -283,6 +284,11 @@ func (ca *CurationAuditCommand) SetIncludeCachedPackages(includeCachedPackages b
283284
return ca
284285
}
285286

287+
func (ca *CurationAuditCommand) SetMvnIncludePluginDeps(mvnIncludePluginDeps bool) *CurationAuditCommand {
288+
ca.mvnIncludePluginDeps = mvnIncludePluginDeps
289+
return ca
290+
}
291+
286292
func (ca *CurationAuditCommand) Run() (err error) {
287293
rootDir, err := os.Getwd()
288294
if err != nil {
@@ -451,7 +457,8 @@ func (ca *CurationAuditCommand) getBuildInfoParamsByTech() (technologies.BuildIn
451457
Args: ca.Args(),
452458
InstallCommandArgs: ca.InstallCommandArgs(),
453459
// Curation params
454-
IsCurationCmd: true,
460+
IsCurationCmd: true,
461+
MvnIncludePluginDeps: ca.mvnIncludePluginDeps,
455462
// Java params
456463
IsMavenDepTreeInstalled: true,
457464
UseWrapper: ca.UseWrapper(),

sca/bom/buildinfo/buildinfobom.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ func GetTechDependencyTree(params technologies.BuildInfoBomGeneratorParams, arti
263263
IsMavenDepTreeInstalled: params.IsMavenDepTreeInstalled,
264264
UseWrapper: params.UseWrapper,
265265
IsCurationCmd: params.IsCurationCmd,
266+
MvnIncludePluginDeps: params.MvnIncludePluginDeps,
266267
CurationCacheFolder: curationCacheFolder,
267268
UseIncludedBuilds: params.UseIncludedBuilds,
268269
}, tech)

sca/bom/buildinfo/technologies/common.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ type BuildInfoBomGeneratorParams struct {
4848
Args []string
4949
InstallCommandArgs []string
5050
// Curation params
51-
IsCurationCmd bool
51+
IsCurationCmd bool
52+
MvnIncludePluginDeps bool
5253
// Java params
5354
IsMavenDepTreeInstalled bool
5455
UseWrapper bool

sca/bom/buildinfo/technologies/java/deptreemanager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type DepTreeParams struct {
3030
DepsRepo string
3131
IsMavenDepTreeInstalled bool
3232
IsCurationCmd bool
33+
MvnIncludePluginDeps bool
3334
CurationCacheFolder string
3435
UseIncludedBuilds bool
3536
}

0 commit comments

Comments
 (0)