Skip to content

BUILD-10724 fix host paths#237

Merged
julien-carsique-sonarsource merged 1 commit intomasterfrom
fix/jcarsique/BUILD-10724-host
Mar 25, 2026
Merged

BUILD-10724 fix host paths#237
julien-carsique-sonarsource merged 1 commit intomasterfrom
fix/jcarsique/BUILD-10724-host

Conversation

@julien-carsique-sonarsource
Copy link
Copy Markdown
Contributor

@julien-carsique-sonarsource julien-carsique-sonarsource commented Mar 25, 2026

The host path cannot be passed as an env, it is modified by the runner hooks.

@julien-carsique-sonarsource julien-carsique-sonarsource requested a review from a team as a code owner March 25, 2026 17:51
Copilot AI review requested due to automatic review settings March 25, 2026 17:51
@hashicorp-vault-sonar-prod
Copy link
Copy Markdown

hashicorp-vault-sonar-prod bot commented Mar 25, 2026

BUILD-10724

@sonar-review-alpha
Copy link
Copy Markdown

Summary

This PR refactors how host action paths are passed to shell scripts across five GitHub Actions. Instead of using an intermediate environment variable, the scripts now directly reference the input variable using GitHub Actions context. This change affects: config-gradle, config-maven, config-npm, config-pip, and get-build-number actions. The logic remains identical—if host-actions-root is provided, use it; otherwise default to the action's directory.

What reviewers should know

All changes follow the same pattern: removing the env: section that declared HOST_ACTIONS_ROOT and replacing ${HOST_ACTIONS_ROOT} with ${{ inputs.host-actions-root }} in the bash script. The refactoring eliminates an extra layer of variable indirection. Check one file to understand the pattern, then skim the others to confirm they're consistent. The conditional logic (if [[ -z "$host_actions_root" ]]) that determines the fallback behavior is unchanged.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 25, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates several internal composite GitHub Actions to adjust how host-actions-root is read when computing local action paths (used when these actions are invoked from other local actions).

Changes:

  • Remove step-level env: HOST_ACTIONS_ROOT: ... wiring.
  • Read host-actions-root directly via ${{ inputs.host-actions-root }} inside the bash run: blocks when computing host_actions_root.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
get-build-number/action.yml Updates local-path resolution to read host-actions-root inline in the bash script.
config-pip/action.yml Updates local-path resolution to read host-actions-root inline in the bash script.
config-npm/action.yml Updates local-path resolution to read host-actions-root inline in the bash script.
config-maven/action.yml Updates local-path resolution to read host-actions-root inline in the bash script.
config-gradle/action.yml Updates local-path resolution to read host-actions-root inline in the bash script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion
This PR inverts a deliberate security fix: the env: → shell-variable indirection pattern that was in place is precisely the mitigation GitHub recommends for script injection. Removing it across all five actions re-opens the vulnerability the original code was written to prevent.

SonarCloud recommendations
Even though the five injection findings are not blocking a named gate condition, I strongly recommend fixing them because they are genuine BLOCKER vulnerabilities:

${{ inputs.host-actions-root }} is interpolated by the GitHub Actions template engine before the shell is invoked. A caller supplying a value like "; malicious-command #" would execute arbitrary shell code in the runner. The previous env: + ${HOST_ACTIONS_ROOT} pattern is exactly the mitigation GitHub documents for this class of vulnerability — it should be restored, not removed.

🗣️ Give feedback

@julien-carsique-sonarsource julien-carsique-sonarsource merged commit 9be4971 into master Mar 25, 2026
28 checks passed
@julien-carsique-sonarsource julien-carsique-sonarsource deleted the fix/jcarsique/BUILD-10724-host branch March 25, 2026 17:58
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.

4 participants