Skip to content

fix shell/code injection in pr-review.yaml#296

Merged
pradeeban merged 1 commit intoControlCore-Project:devfrom
GREENRAT-K405:fix/injection-pr-review
Feb 13, 2026
Merged

fix shell/code injection in pr-review.yaml#296
pradeeban merged 1 commit intoControlCore-Project:devfrom
GREENRAT-K405:fix/injection-pr-review

Conversation

@GREENRAT-K405
Copy link

@pradeeban, done with the changes, please have a look. This fixes #295

Copilot AI review requested due to automatic review settings February 12, 2026 17:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a code injection vulnerability in the GitHub Actions workflow file .github/workflows/PR-review.yaml by properly handling untrusted user inputs. The workflow is triggered by issue comments and previously used direct template expansion of user-controlled values (like github.event.comment.body and github.event.issue.number) within shell run: blocks, which could allow malicious users to inject arbitrary shell commands.

Changes:

  • Modified the "PR Info" step to assign untrusted GitHub event inputs to environment variables before using them in shell commands
  • Modified the "Get PR Details" step to use environment variables for API calls instead of direct template expansion
  • Removed trailing whitespace in the workflow file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +25
#Assign untrusted inputs to environment variables first
COMMENT_BODY: ${{ github.event.comment.body }}
ISSUE_NUM: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
#Use shell variables ("$VAR") instead of template tags
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment placement here is confusing. Line 21's comment appears between the env: key and its values, making the structure unclear. Consider either: (1) indenting it to align with the environment variables (e.g., " #Assign..."), (2) placing it on the same line as env: (e.g., "env: #Assign..."), or (3) moving it above the env: line. Similarly, line 25's comment should be moved inside the run block or placed differently to improve readability.

Copilot uses AI. Check for mistakes.
Comment on lines 40 to +45
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
#Use env vars for the API call to prevent injection
#Use quotes around variables to prevent word splitting
run: |
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment placement here is confusing. Lines 43-44 appear at the wrong indentation level, between the environment variable definitions and the run: key. Consider indenting these comments to align with the environment variables (e.g., " #Use env vars...") to improve readability and make the YAML structure clearer.

Suggested change
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
#Use env vars for the API call to prevent injection
#Use quotes around variables to prevent word splitting
run: |
# Use env vars for the API call to prevent injection
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
run: |
# Use quotes around variables to prevent word splitting

Copilot uses AI. Check for mistakes.
@pradeeban pradeeban merged commit aad272d into ControlCore-Project:dev Feb 13, 2026
11 of 12 checks passed
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.

2 participants