security: fix audit findings (HIGH/MEDIUM)#20
Open
hinanohart wants to merge 1 commit into
Open
Conversation
Pass the workflow_dispatch `milestone` input through an env var instead of inline GitHub Actions expression expansion in the run-step body, and validate it against an M1|M2|M3 allowlist before it reaches the shell/exec sink. This closes a command-injection vector where an input such as "; <command>; echo " would execute arbitrary commands on the self-hosted A100 runner (which also exposes OSF_TOKEN/HF_TOKEN). Also applied accompanying mechanical CI hardening flagged on the same workflow: set persist-credentials: false on checkout, and pin actions/setup-python and actions/upload-artifact to full commit SHAs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security fix: shell injection in
nightly-a100.ymlThis PR addresses one verified MEDIUM finding from the security audit, plus accompanying mechanical CI hardening that the linter (zizmor) flagged on the same workflow.
Fixed
[MEDIUM] Shell injection via
workflow_dispatchinput —.github/workflows/nightly-a100.ymlmilestoneinput was interpolated by the Actions expression engine directly into therun:shell-script body (MILESTONE="${{ github.event.inputs.milestone || 'M1' }}"). An input such as"; <command>; echo "would execute arbitrary commands on the self-hosted A100 runner, which also exposesOSF_TOKENandHF_TOKEN.env: MILESTONE: ...and reference"$MILESTONE"in the script (no inline expression expansion into the shell body), and validate it against anM1|M2|M3allowlist via acasestatement before it reaches the shell/exec sink.Accompanying mechanical hardening on the same workflow (flagged by zizmor on the edited file):
persist-credentials: falseto theactions/checkoutstep (artipacked / credential persistence).actions/setup-pythontoa309ff8b426b58ec0e2a45f0f869d46889d02405(v6.2.0) andactions/upload-artifactto043fb46d1a93c77aae656e7c1c64a875d1fc6a0a(v7.0.1).zizmor .github/workflows/nightly-a100.ymlreports no findings.Verification
zizmor .github/workflows/nightly-a100.yml→ No findings to report.yaml.safe_load).Deferred
ci.yml,claude-resume.yml,hf-deploy.yml,release.yml. These are outside the scope of this single audited finding and were intentionally not modified to avoid sweeping unrelated changes. They should be addressed in a dedicated follow-up.Generated with Claude Code (https://claude.com/claude-code)