Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/language-detection-and-assignment.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Language Detection and Assignment

on:
pull_request:
branches: [main]

workflow_call:
permissions:
pull-requests: write
env:
GH_TOKEN: ${{ secrets.GH_AP_TOKEN }}
GH_TOKEN: ${{ github.token }}
jobs:
detect-and-assign:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -45,4 +45,4 @@
- name: Assign default
if: steps.detect-languages.outputs.java != 'true' && steps.detect-languages.outputs.kotlin != 'true' && steps.detect-languages.outputs.javascript != 'true' && steps.detect-languages.outputs.typescript != 'true' && steps.detect-languages.outputs.go != 'true' && steps.detect-languages.outputs.codeql != 'true' && steps.detect-languages.outputs.python != 'true'
run: |
gh pr edit ${{ github.event.number }} --add-reviewer felickz --add-reviewer Geekmasher --add-reviewer adrienpessu
gh pr edit ${{ github.event.number }} --add-reviewer felickz --add-reviewer felickz --add-reviewer adrienpessu --repo $GITHUB_REPOSITORY

Check warning

Code scanning / CodeQL

Code injection Medium

Potential code injection in
${ github.event.number }
, which may be controlled by an external user.

Copilot Autofix

AI 4 months ago

To fix this code injection vulnerability: Pass the value of github.event.number to an environment variable using the env: map in the step, and access it using the native shell variable syntax (i.e., $PR_NUMBER) instead of direct interpolation. Specifically, for line 48, introduce an environment variable like PR_NUMBER: ${{ github.event.number }} in the step and update the shell command to use $PR_NUMBER. This change should be applied only to the affected step. No imports, methods, or external definitions are needed; only the workflow YAML step is altered to properly pass the input.


Suggested changeset 1
.github/workflows/language-detection-and-assignment.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/language-detection-and-assignment.yml b/.github/workflows/language-detection-and-assignment.yml
--- a/.github/workflows/language-detection-and-assignment.yml
+++ b/.github/workflows/language-detection-and-assignment.yml
@@ -44,5 +44,7 @@
 
       - name: Assign default
         if: steps.detect-languages.outputs.java != 'true' && steps.detect-languages.outputs.kotlin != 'true' && steps.detect-languages.outputs.javascript != 'true' && steps.detect-languages.outputs.typescript != 'true' && steps.detect-languages.outputs.go != 'true'  && steps.detect-languages.outputs.codeql != 'true' && steps.detect-languages.outputs.python != 'true'  
+        env:
+          PR_NUMBER: ${{ github.event.number }}
         run: |
-          gh pr edit ${{ github.event.number }} --add-reviewer felickz --add-reviewer felickz --add-reviewer adrienpessu --repo $GITHUB_REPOSITORY 
+          gh pr edit $PR_NUMBER --add-reviewer felickz --add-reviewer felickz --add-reviewer adrienpessu --repo $GITHUB_REPOSITORY 
EOF
@@ -44,5 +44,7 @@

- name: Assign default
if: steps.detect-languages.outputs.java != 'true' && steps.detect-languages.outputs.kotlin != 'true' && steps.detect-languages.outputs.javascript != 'true' && steps.detect-languages.outputs.typescript != 'true' && steps.detect-languages.outputs.go != 'true' && steps.detect-languages.outputs.codeql != 'true' && steps.detect-languages.outputs.python != 'true'
env:
PR_NUMBER: ${{ github.event.number }}
run: |
gh pr edit ${{ github.event.number }} --add-reviewer felickz --add-reviewer felickz --add-reviewer adrienpessu --repo $GITHUB_REPOSITORY
gh pr edit $PR_NUMBER --add-reviewer felickz --add-reviewer felickz --add-reviewer adrienpessu --repo $GITHUB_REPOSITORY
Copilot is powered by AI and may make mistakes. Always verify output.
24 changes: 12 additions & 12 deletions .github/workflows/sec-opengrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ permissions:
actions: read
security-events: write

env:
# Release version of Opengrep
# https://github.com/opengrep/opengrep/releases
RELEASE_VERSION: v1.1.2

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -27,16 +22,21 @@ jobs:
- name: "Download / Install Opengrep"
run: |
set -e

echo "[+] Downloading Opengrep"
curl -sSfL \
-o "/usr/local/bin/opengrep" \
"https://github.com/opengrep/opengrep/releases/download/${RELEASE_VERSION}/opengrep_manylinux_x86"
echo "[+] Fetching latest Opengrep release information"
API_URL="https://api.github.com/repos/opengrep/opengrep/releases/latest"
ASSET_NAME="opengrep_manylinux_x86"
DOWNLOAD_URL=$(curl -s $API_URL | jq -r ".assets[] | select(.name==\"${ASSET_NAME}\") | .browser_download_url")
if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" = "null" ]; then
echo "Could not find download URL for $ASSET_NAME"
exit 1
fi
echo "[+] Downloading Opengrep from $DOWNLOAD_URL"
curl -sSfL -o "/usr/local/bin/opengrep" "$DOWNLOAD_URL"
chmod +x /usr/local/bin/opengrep
echo "[+] Finished installing opengrep"

- name: "Run Opengrep"
run: opengrep scan --metrics=on --sarif-output ./results.sarif .
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was deprecated

run: opengrep scan --sarif-output ./results.sarif .

- name: "Upload SARIF file"
uses: github/codeql-action/upload-sarif@v3
Expand Down