Skip to content

Conversation

arjunsuresh
Copy link
Collaborator

Potential fix for https://github.com/mlcommons/mlperf-automations/security/code-scanning/3

To fix the problem, assign the untrusted input—${{ github.event.pull_request.head.ref }}—to an intermediate environment variable, then reference that environment variable in the shell command using native shell syntax ($VAR) instead of the ${{ ... }} workflow interpolation. This prevents shell injection because environment variables are treated as simple strings by the shell, making it much harder for malicious content in the variable to break out of the intended usage.

Specifically:

  • Edit the step "Process meta.yaml file" at line 61–67,
  • In run:, replace all workflow interpolations of github.event.pull_request.head.ref (and similarly for head.repo.html_url if desired for defense in depth) with reference to an environment variable,
  • Add an env: block for the step, with a new environment variable, e.g. HEAD_REF: ${{ github.event.pull_request.head.ref }},
  • In the run: script, reference this as $HEAD_REF.

No external libraries or dependencies are required for this change.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copy link
Contributor

github-actions bot commented Sep 4, 2025

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@arjunsuresh arjunsuresh marked this pull request as ready for review September 4, 2025 20:17
@arjunsuresh arjunsuresh requested a review from a team as a code owner September 4, 2025 20:17
@anandhu-eng anandhu-eng merged commit 47843ef into main Sep 5, 2025
99 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2025
@anandhu-eng anandhu-eng deleted the alert-autofix-3 branch September 13, 2025 02:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants