-
-
Notifications
You must be signed in to change notification settings - Fork 8
Fix shell injection vulnerability in GitHub Action workflow #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,20 +38,27 @@ runs: | |
| path: ${{ inputs.working-directory }}/${{ inputs.venv-dir }} | ||
| key: setup-venv-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ steps.setup-python.outputs.python-path }}-${{ hashFiles(inputs.cache-dependency-path) }}-${{ inputs.install-cmd }} | ||
|
|
||
| - run: python -m venv ${{ inputs.venv-dir }} | ||
| - run: python -m venv "$VENV_DIR" | ||
| if: steps.cache-venv.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| env: | ||
| VENV_DIR: ${{ inputs.venv-dir }} | ||
|
|
||
| - run: | | ||
| SCRIPT_DIR="${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}" | ||
| source ${{ inputs.venv-dir }}/${SCRIPT_DIR}/activate | ||
| SCRIPT_DIR="${RUNNER_OS_VENV_SCRIPT_DIR}" | ||
| source "$VENV_DIR"/${SCRIPT_DIR}/activate | ||
| echo "VIRTUAL_ENV=${VIRTUAL_ENV}" >> $GITHUB_ENV | ||
| echo "${VIRTUAL_ENV}/${SCRIPT_DIR}" >> $GITHUB_PATH | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| env: | ||
| RUNNER_OS_VENV_SCRIPT_DIR: ${{ runner.os == 'Windows' && 'Scripts' || 'bin' }} | ||
| VENV_DIR: ${{ inputs.venv-dir }} | ||
|
|
||
| - run: ${{ inputs.install-cmd }} | ||
| - run: "$INSTALL_CMD" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Quoting Suggested FixRemove the double quotes around Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| if: inputs.install-cmd != '' && steps.cache-venv.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| env: | ||
| INSTALL_CMD: ${{ inputs.install-cmd }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quoted command variable prevents shell word splitting
High Severity
Wrapping
$INSTALL_CMDin double quotes ("$INSTALL_CMD") causes bash to treat the entire expanded value as a single token (the command name), suppressing word splitting. For typical values likepip install -r requirements.txt, bash will look for a binary literally namedpip install -r requirements.txtinstead of runningpipwith argumentsinstall,-r,requirements.txt. This breaks the action for essentially all users who supply aninstall-cmd.Reviewed by Cursor Bugbot for commit 965c885. Configure here.