Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ jobs:
echo "continue-build=true" >> $GITHUB_OUTPUT
else
mkdir ./dependabot-pr
echo ${{ github.head_ref }} > ./dependabot-pr/BRANCH_REF
echo ${{ github.event.pull_request.head.sha }} > ./dependabot-pr/PR_HEAD_SHA
printf '%s\n' "${{ github.head_ref }}" > ./dependabot-pr/BRANCH_REF
printf '%s\n' "${{ github.event.pull_request.head.sha }}" > ./dependabot-pr/PR_HEAD_SHA
Comment on lines -131 to +132
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be a protection against some sort of an attack? Why is printf more safe than echo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought maybe to guard against being able to sneak in \ sequences that could potentially alter the output. But now that I think about it more. I don't think head_ref or sha are vulnerable to such things.

echo "$GITHUB_REF" | awk -F / '{print $3}' > ./dependabot-pr/PR_NUMBER
git diff -p --binary > ./dependabot-pr/changes.patch

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/synchronize-dependabot-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ jobs:
exit 1
fi

echo "branch-ref=$(cat /home/runner/work/dependabot-pr/BRANCH_REF)" >> $GITHUB_OUTPUT
echo "pr-head-sha=${PR_HEAD_SHA}" >> $GITHUB_OUTPUT
echo "pr-number=${PR_NUMBER}" >> $GITHUB_OUTPUT
echo "branch-ref=$(cat /home/runner/work/dependabot-pr/BRANCH_REF)" >> "$GITHUB_OUTPUT"
echo "pr-head-sha=${PR_HEAD_SHA}" >> "$GITHUB_OUTPUT"
echo "pr-number=${PR_NUMBER}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout dependabot branch
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand Down