Skip to content

Bugfix/broken pipeline v2#832

Merged
Schmarvinius merged 2 commits into
mainfrom
bugfix/broken-pipeline-v2
May 21, 2026
Merged

Bugfix/broken pipeline v2#832
Schmarvinius merged 2 commits into
mainfrom
bugfix/broken-pipeline-v2

Conversation

@Schmarvinius
Copy link
Copy Markdown
Contributor

@Schmarvinius Schmarvinius commented May 21, 2026

Fix BlackDuck Pipeline: Optional Version Input & Scan Improvements

Bug Fix

🐛 Resolves a broken BlackDuck security scan pipeline by making the version input optional and adding automatic version resolution from Maven, along with several scan stability improvements.

Changes

  • .github/actions/scan-with-blackduck/action.yml:
    • Made the version input optional (previously required), defaulting to an empty string. When not provided, the version is automatically resolved from the Maven revision property, reduced to major.minor format.
    • Added a new "Resolve Project Version" step that handles the fallback logic using mvn help:evaluate.
    • Updated --detect.project.version.name to use the dynamically resolved version from the new step.
    • Added --detect.maven.excluded.scopes=test,provided to exclude test and provided dependencies from scanning.
    • Added --detect.timeout=6000 to prevent scan timeouts.
    • Added --blackduck.signature.scanner.memory=4096 to allocate more memory for the signature scanner.
    • Added --blackduck.trust.cert=true to handle certificate trust issues.
    • Improved scan_mode input description for clarity (FULL vs. RAPID behavior).
  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.20.51

  • File Content Strategy: Full file content
  • Output Template: Default Template
  • Correlation ID: ef4811c8-73c2-41fe-b660-155b125ab0b4
  • Summary Prompt: Default Prompt
  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet

@Schmarvinius Schmarvinius merged commit 0f6beaa into main May 21, 2026
16 of 17 checks passed
@Schmarvinius Schmarvinius deleted the bugfix/broken-pipeline-v2 branch May 21, 2026 12:22
Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights Bot left a comment

Choose a reason for hiding this comment

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

The PR makes sensible improvements — making version optional with a fallback to the Maven revision, improving scan_mode documentation, and adding several missing Detect/BlackDuck arguments. Two issues were flagged: a shell injection risk from inlining the version input directly into the script, and a fragile mvn help:evaluate output parsing that could silently capture spurious Maven log lines instead of the revision value.

PR Bot Information

Version: 1.20.51

  • File Content Strategy: Full file content
  • Correlation ID: ef4811c8-73c2-41fe-b660-155b125ab0b4
  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet
  • Agent Instructions:

Comment on lines +44 to +46
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
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.

Security: Script injection via ${{ inputs.version }} interpolated directly into shell script

inputs.version is interpolated inline into the run script at lines 45–46. A malicious value containing shell metacharacters (e.g. "; malicious_cmd #) would be executed as part of the shell script. The input value should be passed through an environment variable instead.

Consider assigning the input to an env var and referencing it in the script body:

Suggested change
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
if [ -n "$INPUT_VERSION" ]; then
VERSION="$INPUT_VERSION"
else
REVISION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)
VERSION=$(echo "$REVISION" | cut -d. -f1,2)
fi
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "Resolved BlackDuck project version: $VERSION"

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

VERSION="${{ inputs.version }}"
else
REVISION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)
VERSION=$(echo "$REVISION" | cut -d. -f1,2)
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.

Bug: mvn help:evaluate can include spurious output even with -q

mvn help:evaluate -Dexpression=revision -q -DforceStdout occasionally emits warnings or download progress lines before the actual value, especially on first runs or when the local repository is cold. cut -d. -f1,2 applied to such output would silently produce an incorrect version string (e.g. [WARNING][WARNING]).

Consider using tail -1 to reliably take only the last output line (the evaluated value):

Suggested change
VERSION=$(echo "$REVISION" | cut -d. -f1,2)
VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout | tail -1 | cut -d. -f1,2)

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

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.

1 participant