Skip to content

Commit e498784

Browse files
authored
Merge pull request #1587 from blackducksoftware/dev/dterry/IDETECT-4889-excluded-fallbacks
Fallback to other Detectors if primary is excluded
2 parents bfa4d84 + 1f07725 commit e498784

File tree

3 files changed

+81
-55
lines changed

3 files changed

+81
-55
lines changed

detector/src/main/java/com/blackduck/integration/detector/accuracy/entrypoint/DetectorRuleEvaluator.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ private EntryPointFoundResult evaluateEntryPoint(
7676
return null;
7777
}
7878

79-
DetectableDefinition definition = entryPoint.getPrimary();
80-
if (detectableExclusionEvaluator.isDetectableExcluded(definition)) {
79+
DetectableDefinition definition = selectDetectableDefinition(entryPoint);
80+
if (definition == null) {
8181
return null;
8282
}
8383

84-
Detectable primaryDetectable = definition.getDetectableCreatable().createDetectable(environment);
85-
DetectableResult applicable = primaryDetectable.applicable();
84+
Detectable selectedDetectable = definition.getDetectableCreatable().createDetectable(environment);
85+
DetectableResult applicable = selectedDetectable.applicable();
8686
if (!applicable.getPassed()) {
8787
notFoundEntryPoints.add(EntryPointNotFoundResult.notApplicable(entryPoint, searchResult, applicable));
8888
return null;
@@ -92,6 +92,26 @@ private EntryPointFoundResult evaluateEntryPoint(
9292
return EntryPointFoundResult.evaluated(entryPoint, searchResult, applicable, entryPointEvaluation);
9393
}
9494

95+
private DetectableDefinition selectDetectableDefinition(EntryPoint entryPoint) {
96+
DetectableDefinition primary = entryPoint.getPrimary();
97+
if (!detectableExclusionEvaluator.isDetectableExcluded(primary)) {
98+
return primary;
99+
}
100+
101+
// Primary is excluded, look for the first non-excluded fallback
102+
List<DetectableDefinition> fallbacks = entryPoint.getFallbacks();
103+
if (fallbacks != null) {
104+
for (DetectableDefinition fallback : fallbacks) {
105+
if (!detectableExclusionEvaluator.isDetectableExcluded(fallback)) {
106+
return fallback;
107+
}
108+
}
109+
}
110+
111+
// No valid definition found
112+
return null;
113+
}
114+
95115
private EntryPointEvaluation extract(EntryPoint entryPoint, DetectableEnvironment detectableEnvironment, Supplier<ExtractionEnvironment> extractionEnvironmentSupplier) {
96116
List<DetectableDefinition> toCascade = entryPoint.allDetectables();
97117
List<DetectableEvaluationResult> evaluated = new ArrayList<>();

documentation/src/main/markdown/currentreleasenotes.md

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,57 +18,8 @@
1818
* eu.store.scass.blackduck.com - 34.54.213.11
1919
* eu.scass.blackduck.com - 34.54.38.252
2020

21-
## Version 11.0.0
22-
23-
### New features
24-
25-
* When enabled, the new [detect.project.deep.license](properties/configuration/project.md#deep-license-analysis) property sets the Deep License Data and Deep License Data Snippet fields when creating a project. This property can also be used to update existing projects when the [detect.project.version.update](properties/configuration/project.md#update-project-version) property is set to true.
26-
* The new [detect.project.settings](properties/configuration/project.md#project-settings-via-json) property takes as input a path to a JSON file. This file allows users to pass several existing `detect.project` properties as a single argument to Detect. Detect will parse the JSON file to obtain information relevant to creating or updating projects.
27-
* The new [detect.excluded.detectors](properties/configuration/detector.md#detectors-excluded-advanced) property takes as input a comma-separated list of Detector names to exclude. This allows for greater control over selection of Detectors.
28-
* Added support for capturing dependencies from the `go.mod` file via a new buildless detector named "Go Mod File" for Go projects.
29-
* Added a new property [detect.go.forge](properties/detectors/go.md#go-forge-url) to customize the Go registry URL used for fetching dependency information. Defaults to `https://proxy.golang.org`.
30-
* Added a new property [detect.go.forge.connection.timeout](properties/detectors/go.md#go-forge-connection-timeout) to customize the connection timeout limit while connecting to the Go registry. Defaults to 30 seconds.
31-
* Added a new property [detect.go.forge.read.timeout](properties/detectors/go.md#go-forge-read-timeout) to customize the read timeout limit while fetching go.mod file of a dependency from Go registry. Defaults to 60 seconds.
21+
## Version 11.1.0
3222

3323
### Changed features
3424

35-
* ReversingLabs Scans (`detect.tools=THREAT_INTEL`) has been removed.
36-
* The `detect.threatintel.scan.file.path` property has been removed.
37-
* The `detect.project.codelocation.unmap` property has been removed.
38-
* The archived phase (`detect.project.version.phase=ARCHIVED`) has been deprecated.
39-
* The efficiency of the Detector directory evaluation has been enhanced, resulting in the acceleration of certain scans.
40-
* Detector directory evaluation has been made more efficient, resulting in some scans being faster.
41-
* Support for `pyproject.toml` file has been added to PIP Native Inspector. For more details, please see [Python Detector page](packagemgrs/python.md)
42-
* Support for the following package managers have been extended:
43-
* pip: 25.2
44-
* pipenv: 2025.0.4
45-
* Setuptools: 80.9.0
46-
* uv: 0.8.15
47-
* Maven: 3.9.11
48-
* Conan: 2.20.1
49-
* NuGet: 6.8.1
50-
* GoLang: 1.25
51-
* RubyGems: 3.7.1
52-
* Gradle: 9.0.0
53-
* Yarn: 4.9.4
54-
* NPM: 11.5.2
55-
56-
### Resolved issues
57-
58-
* (IDETECT-4738) Corrected behavior of `detect.binary.scan.file.name.patterns` to be case-insensitive.
59-
* (IDETECT-4802) Fix UV Lockfile Detector not generating BDIOs for projects with non-normalized names per Python requirements.
60-
* (IDETECT-4806) Fixed UV detectors to handle dynamic versions and cyclic dependencies.
61-
* (IDETECT-4751) Prevent server-side parsing errors by normalizing IAC Scan `results.json` contents before uploading to Black Duck SCA.
62-
* (IDETECT-4799) When constructing the BDIO, ignore the Go toolchain directive, as it is the Go project's build-time configuration setting and not a module dependency.
63-
* (IDETECT-4813) Fix Gradle Native Inspector to correctly identify projects with only `settings.gradle` or `settings.gradle.kts` file in the root directory.
64-
* (IDETECT-4812) Gradle Native Inspector now supports configuration cache (refactored `init-detect.gradle` to add support for configuration cache in Gradle projects).
65-
* (IDETECT-4845) With added support for extracting Python package versions from direct references [PEP 508 URIs](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers) in `pyproject.toml` files, [detect_product_short] now correctly parses versions from wheel and archive URLs and VCS references for impacted detectors (Setuptools CLI, Setuptools Parse, and UV Lock detectors). When data is missing or badly formatted, detectors gracefully switch back to reporting only the package name.
66-
* (IDETECT-4810) Exclude unnecessary directories when looking for the locations of dependency declarations to enhance performance when Component Location Analysis is enabled.
67-
* (IDETECT-4724) Updated Yarn Detector to correctly identify components that were previously unmatched.
68-
* (IDETECT-4850) Log a warning when unsupported `PROC_MACRO` dependency exclusion is attempted with the Cargo Lockfile Detector.
69-
* (IDETECT-4591) The logic for enabling the IAC_SCAN tool has been updated to rely solely on detect.tools and detect.tools.excluded.
70-
* (IDETECT-4786) `BDIO` uploads will no longer retry unnecessarily when the Black Duck SCA server returns a 412 (Precondition Failed), improving scan efficiency and avoiding timeouts.
71-
72-
### Dependency updates
73-
* Upgraded and released Docker Inspector version 11.6.0.
74-
* Upgraded and released Nuget Inspector version 2.3.2.
25+
* When using the `detect.excluded.detectors` property, any fallback Detectors will now we executed if the primary Detector is excluded. Previously, entire sets of Detectors would be excluded.

documentation/src/main/markdown/previousreleasenotes.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
<!-- Check the support matrix to determine supported, non-current major version releases -->
22
# Release notes for previous [detect_product_short] versions
33

4+
## Version 11.0.0
5+
6+
### New features
7+
8+
* When enabled, the new [detect.project.deep.license](properties/configuration/project.md#deep-license-analysis) property sets the Deep License Data and Deep License Data Snippet fields when creating a project. This property can also be used to update existing projects when the [detect.project.version.update](properties/configuration/project.md#update-project-version) property is set to true.
9+
* The new [detect.project.settings](properties/configuration/project.md#project-settings-via-json) property takes as input a path to a JSON file. This file allows users to pass several existing `detect.project` properties as a single argument to Detect. Detect will parse the JSON file to obtain information relevant to creating or updating projects.
10+
* The new [detect.excluded.detectors](properties/configuration/detector.md#detectors-excluded-advanced) property takes as input a comma-separated list of Detector names to exclude. This allows for greater control over selection of Detectors.
11+
* Added support for capturing dependencies from the `go.mod` file via a new buildless detector named "Go Mod File" for Go projects.
12+
* Added a new property [detect.go.forge](properties/detectors/go.md#go-forge-url) to customize the Go registry URL used for fetching dependency information. Defaults to `https://proxy.golang.org`.
13+
* Added a new property [detect.go.forge.connection.timeout](properties/detectors/go.md#go-forge-connection-timeout) to customize the connection timeout limit while connecting to the Go registry. Defaults to 30 seconds.
14+
* Added a new property [detect.go.forge.read.timeout](properties/detectors/go.md#go-forge-read-timeout) to customize the read timeout limit while fetching go.mod file of a dependency from Go registry. Defaults to 60 seconds.
15+
16+
### Changed features
17+
18+
* ReversingLabs Scans (`detect.tools=THREAT_INTEL`) has been removed.
19+
* The `detect.threatintel.scan.file.path` property has been removed.
20+
* The `detect.project.codelocation.unmap` property has been removed.
21+
* The archived phase (`detect.project.version.phase=ARCHIVED`) has been deprecated.
22+
* The efficiency of the Detector directory evaluation has been enhanced, resulting in the acceleration of certain scans.
23+
* Detector directory evaluation has been made more efficient, resulting in some scans being faster.
24+
* Support for `pyproject.toml` file has been added to PIP Native Inspector. For more details, please see [Python Detector page](packagemgrs/python.md)
25+
* Support for the following package managers have been extended:
26+
* pip: 25.2
27+
* pipenv: 2025.0.4
28+
* Setuptools: 80.9.0
29+
* uv: 0.8.15
30+
* Maven: 3.9.11
31+
* Conan: 2.20.1
32+
* NuGet: 6.8.1
33+
* GoLang: 1.25
34+
* RubyGems: 3.7.1
35+
* Gradle: 9.0.0
36+
* Yarn: 4.9.4
37+
* NPM: 11.5.2
38+
39+
### Resolved issues
40+
41+
* (IDETECT-4738) Corrected behavior of `detect.binary.scan.file.name.patterns` to be case-insensitive.
42+
* (IDETECT-4802) Fix UV Lockfile Detector not generating BDIOs for projects with non-normalized names per Python requirements.
43+
* (IDETECT-4806) Fixed UV detectors to handle dynamic versions and cyclic dependencies.
44+
* (IDETECT-4751) Prevent server-side parsing errors by normalizing IAC Scan `results.json` contents before uploading to Black Duck SCA.
45+
* (IDETECT-4799) When constructing the BDIO, ignore the Go toolchain directive, as it is the Go project's build-time configuration setting and not a module dependency.
46+
* (IDETECT-4813) Fix Gradle Native Inspector to correctly identify projects with only `settings.gradle` or `settings.gradle.kts` file in the root directory.
47+
* (IDETECT-4812) Gradle Native Inspector now supports configuration cache (refactored `init-detect.gradle` to add support for configuration cache in Gradle projects).
48+
* (IDETECT-4845) With added support for extracting Python package versions from direct references [PEP 508 URIs](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers) in `pyproject.toml` files, [detect_product_short] now correctly parses versions from wheel and archive URLs and VCS references for impacted detectors (Setuptools CLI, Setuptools Parse, and UV Lock detectors). When data is missing or badly formatted, detectors gracefully switch back to reporting only the package name.
49+
* (IDETECT-4810) Exclude unnecessary directories when looking for the locations of dependency declarations to enhance performance when Component Location Analysis is enabled.
50+
* (IDETECT-4724) Updated Yarn Detector to correctly identify components that were previously unmatched.
51+
* (IDETECT-4850) Log a warning when unsupported `PROC_MACRO` dependency exclusion is attempted with the Cargo Lockfile Detector.
52+
* (IDETECT-4591) The logic for enabling the IAC_SCAN tool has been updated to rely solely on detect.tools and detect.tools.excluded.
53+
* (IDETECT-4786) `BDIO` uploads will no longer retry unnecessarily when the Black Duck SCA server returns a 412 (Precondition Failed), improving scan efficiency and avoiding timeouts.
54+
55+
### Dependency updates
56+
* Upgraded and released Docker Inspector version 11.6.0.
57+
* Upgraded and released Nuget Inspector version 2.3.2.
58+
459
## Version 10.7.0
560

661
### New features

0 commit comments

Comments
 (0)