Skip to content

Commit f90b2db

Browse files
authored
Fix script injection in release notes PR trigger workflow (#24828)
## Description The `release-notes-pr-trigger` workflow was interpolating PR context values (`html_url`, `title`, `user.login`) directly into a shell heredoc. A specially crafted PR title or author name could break out of the JSON string and execute arbitrary commands. This change moves the GitHub context values into environment variables and uses `jq` to safely construct the JSON artifact, eliminating the injection vector. ## Related issues or tickets None ## Reviews - [x] Technical review Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
1 parent dc79776 commit f90b2db

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/release-notes-pr-trigger.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ jobs:
1212
if: github.repository_owner == 'docker'
1313
steps:
1414
- name: Save PR details
15+
env:
16+
PR_URL: ${{ github.event.pull_request.html_url }}
17+
PR_TITLE: ${{ github.event.pull_request.title }}
18+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
1519
run: |
16-
cat <<'EOF' > pr-details.json
17-
{
18-
"url": "${{ github.event.pull_request.html_url }}",
19-
"title": "${{ github.event.pull_request.title }}",
20-
"author": "${{ github.event.pull_request.user.login }}"
21-
}
22-
EOF
20+
jq -n \
21+
--arg url "$PR_URL" \
22+
--arg title "$PR_TITLE" \
23+
--arg author "$PR_AUTHOR" \
24+
'{url: $url, title: $title, author: $author}' > pr-details.json
2325
2426
- name: Upload PR details
2527
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7

0 commit comments

Comments
 (0)