Skip to content

Conversation

arjunsuresh
Copy link
Collaborator

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

To fix this problem, we should prevent untrusted user-controlled input from being directly used in the shell context. The recommended approach is to pass the untrusted value (here, github.event.pull_request.head.ref) into an environment variable, and use the native shell environment variable syntax to reference it ($BRANCH). Specifically, for line 49: introduce an env: block to set the environment variable (for example, BRANCH: ${{ github.event.pull_request.head.ref }}), then reference it as --branch="$BRANCH" in the shell script. Similarly, consider also using REPO: ${{ github.event.pull_request.head.repo.html_url }} for consistency and security, though only the head.ref has been flagged.

The only required changes are within the relevant step in .github/workflows/test-mlperf-inference-retinanet.yml; no new imports or methods are needed, and no other files must be changed.

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 15:54
@arjunsuresh arjunsuresh requested a review from a team as a code owner September 4, 2025 15:54
@anandhu-eng anandhu-eng merged commit c59d6a2 into main Sep 4, 2025
98 of 101 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2025
@anandhu-eng anandhu-eng deleted the alert-autofix-12 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