Skip to content

fix: prevent expression injection in pr-command workflow (CWE-78) - #678

Merged
dushyantbehl merged 1 commit into
foundation-model-stack:mainfrom
YashasviChaurasia:fix/gh-actions-expression-injection
Sep 3, 2026
Merged

fix: prevent expression injection in pr-command workflow (CWE-78)#678
dushyantbehl merged 1 commit into
foundation-model-stack:mainfrom
YashasviChaurasia:fix/gh-actions-expression-injection

Conversation

@YashasviChaurasia

Copy link
Copy Markdown
Contributor

Description of the change

  • Fixes a GitHub Actions expression injection vulnerability in .github/workflows/pr-command.yaml (CVSS 3.1: 8.6 High)
  • The github.event.comment.body was interpolated directly into a run: block via ${{ }}, allowing arbitrary command injection through crafted PR comments
  • Moved the comment body to an env: variable so the shell receives it as a plain string, preventing injection

Details

Before (vulnerable):

  run: |
    COMMENT="${{ github.event.comment.body }}"

After (safe):

  env:
    COMMENT: ${{ github.event.comment.body }}
  run: |
    if [[ "$COMMENT" == /build* ]]; then

References

Test plan

  • Verify /build comment still triggers the build job
  • Verify /merge comment still triggers the merge job
  • Confirm no expression injection is possible via crafted comments

Related issue number

How to verify the PR

Was the PR tested

  • I have added >=1 unit test(s) for every new method I have added.
  • I have ensured all unit tests pass

Signed-off-by: yashasvi <yashasvi@ibm.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Thanks for making a pull request! 馃槂
One of the maintainers will review and advise on the next steps.

@github-actions github-actions Bot added the fix label Sep 2, 2026
@dushyantbehl
dushyantbehl merged commit 4e55450 into foundation-model-stack:main Sep 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants