Skip to content

Commit 89abcdf

Browse files
ADFA-4184: Fix run-shell-injection risk in debug.yml Extract Jira step
The "Extract Jira Ticket and Fetch Title" step interpolated github context (github.repository, github.sha, github.ref) and secrets directly into its run: script. Those values are attacker-controllable, so a crafted branch or commit could inject shell code on the runner. Move every ${{ ... }} interpolation into the step's env: block and reference them as double-quoted shell variables, per the Semgrep run-shell-injection guidance. Semgrep p/github-actions now reports 0 findings (was 1).
1 parent 5f14ef7 commit 89abcdf

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎.github/workflows/debug.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ jobs:
251251
env:
252252
COMMIT_MSG: ${{ steps.pr_info.outputs.COMMIT_MSG }}
253253
BRANCH_TYPE: ${{ needs.validate_branch.outputs.branch_type }}
254+
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
255+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
256+
REPO: ${{ github.repository }}
257+
SHA: ${{ github.sha }}
258+
REF: ${{ github.ref }}
254259
run: |
255260
if [[ "$BRANCH_TYPE" == "community" ]]; then
256261
echo "Community branch, skipping Jira ticket extraction"
@@ -268,9 +273,9 @@ jobs:
268273
JIRA_URL="https://appdevforall.atlassian.net/browse/${JIRA_TICKET}"
269274
270275
# Fetch Jira ticket title if credentials are available
271-
if [ -n "${{ secrets.JIRA_EMAIL }}" ] && [ -n "${{ secrets.JIRA_API_TOKEN }}" ]; then
276+
if [ -n "$JIRA_EMAIL" ] && [ -n "$JIRA_API_TOKEN" ]; then
272277
JIRA_TITLE=$(curl -s \
273-
-u "${{ secrets.JIRA_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}" \
278+
-u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
274279
-H "Accept: application/json" \
275280
"https://appdevforall.atlassian.net/rest/api/3/issue/${JIRA_TICKET}?fields=summary" \
276281
| jq -r '.fields.summary // ""' 2>/dev/null || echo "")
@@ -285,7 +290,7 @@ jobs:
285290
else
286291
JIRA_TICKET="N/A"
287292
JIRA_TITLE="$COMMIT_MSG"
288-
JIRA_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }} (Ref: ${{ github.ref }})"
293+
JIRA_URL="https://github.com/${REPO}/commit/${SHA} (Ref: ${REF})"
289294
fi
290295
291296
echo "JIRA_TICKET=$JIRA_TICKET" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)