Open
Conversation
Comment on lines
+73
to
+83
| run: | | ||
| cp package.json ./build | ||
| cd build | ||
| git init | ||
| git config user.email "admin@apty.io" | ||
| git config user.name "git-ci" | ||
| git add . | ||
| git commit -m "${{needs.rules.outputs.branch_name}}-${{github.event.head_commit.message}}" -a | ||
| git remote add origin "git@github.com:aptyInc/tinymce-react.git" | ||
| git checkout -b "${{needs.rules.outputs.branch_name}}-${{ github.sha }}" | ||
| git push origin "${{needs.rules.outputs.branch_name}}-${{ github.sha }}" |
Check failure
Code scanning / CodeQL
Expression injection in Actions Critical
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to avoid using user-controlled input directly in the run command. Instead, we should set the untrusted input value to an intermediate environment variable and then use the environment variable using the native shell syntax. This will prevent any potential code injection.
Specifically, we will:
- Set the
branch_nameandcommit_messageto environment variables. - Use these environment variables in the
runcommand using shell syntax.
Suggested changeset
1
.github/workflows/config.yaml
| @@ -72,2 +72,6 @@ | ||
| - name: Commit code for tinymce-react | ||
| env: | ||
| BRANCH_NAME: ${{ needs.rules.outputs.branch_name }} | ||
| COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
| GITHUB_SHA: ${{ github.sha }} | ||
| run: | | ||
| @@ -79,6 +83,6 @@ | ||
| git add . | ||
| git commit -m "${{needs.rules.outputs.branch_name}}-${{github.event.head_commit.message}}" -a | ||
| git commit -m "${BRANCH_NAME}-${COMMIT_MESSAGE}" -a | ||
| git remote add origin "git@github.com:aptyInc/tinymce-react.git" | ||
| git checkout -b "${{needs.rules.outputs.branch_name}}-${{ github.sha }}" | ||
| git push origin "${{needs.rules.outputs.branch_name}}-${{ github.sha }}" | ||
| git checkout -b "${BRANCH_NAME}-${GITHUB_SHA}" | ||
| git push origin "${BRANCH_NAME}-${GITHUB_SHA}" | ||
| notifications: |
Copilot is powered by AI and may make mistakes. Always verify output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed remotely hosted URL