Skip to content

fix: use env var indirection for inputs.components (CMD_EXEC)#179

Open
nbuckwalt wants to merge 2 commits into
dtolnay:masterfrom
nbuckwalt:fix/cmd-exec-inputs-components
Open

fix: use env var indirection for inputs.components (CMD_EXEC)#179
nbuckwalt wants to merge 2 commits into
dtolnay:masterfrom
nbuckwalt:fix/cmd-exec-inputs-components

Conversation

@nbuckwalt
Copy link
Copy Markdown

Security Fix: CMD_EXEC via inputs.components

Summary

`inputs.components` is directly interpolated into a `run:` shell command via a GitHub Actions expression:
```
echo "downgrade=${{steps.parse.outputs.toolchain == 'nightly' && inputs.components && ' --allow-downgrade' || ''}}" >> $GITHUB_OUTPUT
```
A caller passing a malicious value such as `'; arbitrary_command; echo '` as `components` would execute arbitrary shell code in any job using this action.

Fix

Replace the inline expression with equivalent shell logic using `env:` variables (`TOOLCHAIN`, `COMPONENTS`). Output behavior is identical: ` --allow-downgrade` (with leading space) when toolchain is `nightly` and components is non-empty, empty string otherwise.

References

🤖 Generated with Claude Code

@nbuckwalt nbuckwalt closed this Mar 26, 2026
@nbuckwalt nbuckwalt reopened this Mar 26, 2026
@nbuckwalt nbuckwalt closed this Mar 26, 2026
@nbuckwalt nbuckwalt reopened this Mar 26, 2026
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