Skip to content

fix(binary-scan): warn instead of fail when no files match configured patterns#1735

Open
bd-spratikbharti wants to merge 1 commit intomasterfrom
IDETECT-5079
Open

fix(binary-scan): warn instead of fail when no files match configured patterns#1735
bd-spratikbharti wants to merge 1 commit intomasterfrom
IDETECT-5079

Conversation

@bd-spratikbharti
Copy link
Copy Markdown
Collaborator

Description

Summary

  • Binary scan no longer fails with exit code 11 when detect.binary.scan.file.name.patterns is configured but no matching files are found
  • Changed hard failure to a warning log, allowing the scan to continue and exit cleanly
  • When search depth is at default (0), the warning suggests using detect.binary.scan.search.depth for files in subdirectories

Context

Projects in CI/CD pipelines often have binary scan patterns (e.g. *.jar) configured globally, but not every project produces matching binaries. Previously, this
caused FAILURE_BLACKDUCK_FEATURE_ERROR (exit code 11), failing the pipeline unnecessarily.

Other binary scan paths (no patterns configured, autonomous mode) already handled "no binaries found" gracefully. This change makes the pattern-matching path
consistent with that behavior.

What's NOT changed

  • Explicit file path (detect.binary.scan.file.path) pointing to a missing/unreadable file still fails — that's a legitimate config error
  • Server upload failures still fail
  • All other scan types are unaffected

Copy link
Copy Markdown
Contributor

@dterrybd dterrybd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. Adding Chris to review the message changes.

multiTargets.forEach(operationRunner::updateBinaryUserTargets);
} else {
operationRunner.publishBinaryFailure("Binary scanner did not find any files matching any pattern.");
String message = "Binary scanner did not find any files matching the configured patterns.";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nittiest of nits: I believe we have generally capitalized "Scanner" when referring to the tool. (Which was not done in the original line 71 but was in line 78 so we've perhaps not been consistent.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out — happy to fix capitalization in a follow‑up if you’d like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants