Skip to content

build: revert infinite loop changes#141

Merged
JamesGeorg merged 2 commits intomainfrom
npm-migration-5
Dec 13, 2025
Merged

build: revert infinite loop changes#141
JamesGeorg merged 2 commits intomainfrom
npm-migration-5

Conversation

@Hari-Thakur-27
Copy link
Contributor

No description provided.

shopt -s nocasematch

COMMITS="$(git log --format=%B ${{ github.event.before }}..${{ github.sha }})"
PR_TITLE='${{ github.event.pull_request.title }}'

Check failure

Code scanning / CodeQL

Code injection Critical

Potential code injection in
${ github.event.pull_request.title }
, which may be controlled by an external user (
pull_request_target
).

Copilot Autofix

AI 3 months ago

To prevent potential code injection vulnerabilities with user-controlled input, the recommended GitHub Actions pattern is to pass the value into an environment variable and reference that variable from the shell. This involves two changes:

  1. Add an entry under env: in the problematic run: step, assigning something like PR_TITLE: ${{ github.event.pull_request.title }}.
  2. In the run: block, remove the direct variable assignment (PR_TITLE='...'), and simply use $PR_TITLE as needed.

In this case, we:

  • Remove line 46 (PR_TITLE='${{ github.event.pull_request.title }}').
  • Add env: under the step, defining PR_TITLE: ${{ github.event.pull_request.title }}.
  • All subsequent references to $PR_TITLE in the run: block already use the correct syntax.

No new methods or imports are required.


Suggested changeset 1
.github/workflows/release.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -43,8 +43,6 @@
         run: |
           shopt -s nocasematch
 
-          PR_TITLE='${{ github.event.pull_request.title }}'
-
           if [[ "$PR_TITLE" =~ (\[breaking\]|\[major\]) ]]; then
             echo "release_type=major" >> $GITHUB_OUTPUT
           elif [[ "$PR_TITLE" =~ \[minor\] ]]; then
@@ -55,6 +53,8 @@
 
           shopt -u nocasematch
         shell: bash
+        env:
+          PR_TITLE: ${{ github.event.pull_request.title }}
 
       - name: Conventional Changelog Action
         id: changelog
EOF
@@ -43,8 +43,6 @@
run: |
shopt -s nocasematch

PR_TITLE='${{ github.event.pull_request.title }}'

if [[ "$PR_TITLE" =~ (\[breaking\]|\[major\]) ]]; then
echo "release_type=major" >> $GITHUB_OUTPUT
elif [[ "$PR_TITLE" =~ \[minor\] ]]; then
@@ -55,6 +53,8 @@

shopt -u nocasematch
shell: bash
env:
PR_TITLE: ${{ github.event.pull_request.title }}

- name: Conventional Changelog Action
id: changelog
Copilot is powered by AI and may make mistakes. Always verify output.
@JamesGeorg JamesGeorg merged commit 1bf44bf into main Dec 13, 2025
5 of 6 checks passed
@JamesGeorg JamesGeorg deleted the npm-migration-5 branch December 13, 2025 08:28
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