Skip to content

Commit

Permalink
Fix command injection vulnerability in autoTestPR (#2244)
Browse files Browse the repository at this point in the history
Fixes a command injection vulnerability with the auto test PR GitHub Workflow.

See https://securitylab.github.com/research/github-actions-untrusted-input

Also removes the unecessary `&& github.event_name != 'pull_request'` condition from the autoTestPR job because it will always be satisfied. (This workflow only triggers upon issue_comment, so `github.event_name` will never be 'pull_request')
  • Loading branch information
Icohedron authored Feb 9, 2021
1 parent 2227228 commit 1cc3a47
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/autoTestPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
autoTestPR:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, 'auto exclude test') && github.event_name != 'pull_request'
if: startsWith(github.event.comment.body, 'auto exclude test')
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand All @@ -28,9 +28,11 @@ jobs:
ref: 'master'
path: 'TKG'
- name: run script
env:
comment_body: ${{ github.event.comment.body }}
run: |
git config --list
python TKG/scripts/testBot/disable.py -m "${{ github.event.comment.body }}" -c "${{ github.event.comment.html_url }}" -d "$GITHUB_WORKSPACE/tests"
python TKG/scripts/testBot/disable.py -m "$comment_body" -c "${{ github.event.comment.html_url }}" -d "$GITHUB_WORKSPACE/tests"
- name: test cannot be found
if: failure()
run: |
Expand All @@ -48,4 +50,4 @@ jobs:
- related: ${{ github.event.comment.html_url }}
branch: 'autoTestPR'
branch-suffix: 'random'
signoff: 'true'
signoff: 'true'

0 comments on commit 1cc3a47

Please sign in to comment.