-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ALCS-2227: Configure dependabot #2169
Conversation
run: | | ||
# Get PR number from branch name | ||
PR_NUMBER=$(echo ${{ github.event.workflow_run.head_branch }} | grep -o '[0-9]\+' || echo '') | ||
|
||
if [ -n "$PR_NUMBER" ]; then | ||
# Approve PR | ||
gh pr review $PR_NUMBER --approve | ||
|
||
# Enable auto-merge | ||
gh pr merge $PR_NUMBER --auto --merge | ||
fi |
Check failure
Code scanning / CodeQL
Expression injection in Actions Critical
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 13 days ago
To fix the problem, we need to avoid using the untrusted input value directly in the shell command. Instead, we should set the untrusted input value to an intermediate environment variable and then use the environment variable using the native syntax of the shell. This approach prevents the injection vulnerability by ensuring that the value is treated as a plain string rather than being interpreted as part of the shell command.
Specifically, we will:
- Set the
PR_NUMBER
value to an environment variable. - Use the environment variable in the shell command.
-
Copy modified lines R25-R27 -
Copy modified line R30 -
Copy modified line R34 -
Copy modified line R37
@@ -24,5 +24,8 @@ | ||
- name: Auto-merge Dependabot PR | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} | ||
run: | | ||
# Get PR number from branch name | ||
PR_NUMBER=$(echo ${{ github.event.workflow_run.head_branch }} | grep -o '[0-9]\+' || echo '') | ||
PR_NUMBER=$(echo "$HEAD_BRANCH" | grep -o '[0-9]\+' || echo '') | ||
|
||
@@ -30,8 +33,5 @@ | ||
# Approve PR | ||
gh pr review $PR_NUMBER --approve | ||
gh pr review "$PR_NUMBER" --approve | ||
|
||
# Enable auto-merge | ||
gh pr merge $PR_NUMBER --auto --merge | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
gh pr merge "$PR_NUMBER" --auto --merge |
No description provided.