Skip to content

Conversation

namespacebrian
Copy link
Contributor

When I tested this, it didn't seem to print the additional information and I'm not sure why.

namespacebrian and others added 2 commits July 25, 2025 14:25
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- name: Install Terminus
shell: bash
run: |
FINAL_VERSION="${{ inputs.terminus-version || env.TERMINUS_RELEASE }}"

Check warning

Code scanning / CodeQL

Code injection Medium

Potential code injection in
${ inputs.terminus-version || env.TERMINUS_RELEASE }
, which may be controlled by an external user.
Potential code injection in
${ inputs.terminus-version || env.TERMINUS_RELEASE }
, which may be controlled by an external user.

Copilot Autofix

AI 2 months ago

To fix the issue, we will:

  1. Assign the untrusted input (inputs.terminus-version || env.TERMINUS_RELEASE) to an intermediate environment variable.
  2. Use the shell's native syntax ($VARIABLE) to reference the environment variable in the script, instead of directly interpolating it with ${{ ... }}.
  3. Ensure that the input is sanitized or validated before use, if necessary.

This approach prevents direct interpolation of untrusted input into the shell script, mitigating the risk of code injection.


Suggested changeset 1
action.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/action.yml b/action.yml
--- a/action.yml
+++ b/action.yml
@@ -54,3 +54,3 @@
       run: |
-        FINAL_VERSION="${{ inputs.terminus-version || env.TERMINUS_RELEASE }}"
+        FINAL_VERSION="$TERMINUS_VERSION"
 
@@ -91,3 +91,3 @@
       env:
-        TERMINUS_RELEASE: ${{ inputs.terminus-version || env.TERMINUS_RELEASE }}
+        TERMINUS_VERSION: ${{ inputs.terminus-version || env.TERMINUS_RELEASE }}
         DEBUG: ${{ inputs.debug }}
EOF
@@ -54,3 +54,3 @@
run: |
FINAL_VERSION="${{ inputs.terminus-version || env.TERMINUS_RELEASE }}"
FINAL_VERSION="$TERMINUS_VERSION"

@@ -91,3 +91,3 @@
env:
TERMINUS_RELEASE: ${{ inputs.terminus-version || env.TERMINUS_RELEASE }}
TERMINUS_VERSION: ${{ inputs.terminus-version || env.TERMINUS_RELEASE }}
DEBUG: ${{ inputs.debug }}
Copilot is powered by AI and may make mistakes. Always verify output.
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.

1 participant