Skip to content

Conversation

@d-oit
Copy link
Owner

@d-oit d-oit commented Aug 18, 2025

Potential fix for https://github.com/d-oit/gh-sub-issues/security/code-scanning/4

To fix the code injection vulnerability, we should pass the untrusted input (github.event.comment.body) to the shell script via an environment variable, and then use shell-native variable expansion ($comment_body) in the script. Specifically, in the step "Handle sub-issue creation requests", move the assignment of comment_body from the shell script to the env: section of the step. In the script, reference $comment_body as a shell variable. This prevents code injection because the shell will treat the value as a literal string, not as code to be executed.

Required changes:

  • In the step at line 87-110, move the assignment of comment_body from the script to the env: section.
  • In the script, reference $comment_body instead of assigning it.
  • Ensure all usages of $comment_body are properly quoted.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@d-oit d-oit marked this pull request as ready for review August 19, 2025 15:03
@d-oit d-oit merged commit 8cdcd9f into main Aug 19, 2025
4 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