Skip to content

Commit 1b92369

Browse files
committed
Zizmor: fix violations of "template-injection"
https://docs.zizmor.sh/audits/#template-injection Closes #232
1 parent 1fdefc1 commit 1b92369

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

.github/workflows/build-all.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,16 +646,16 @@ jobs:
646646
- name: Define properties
647647
shell: bash
648648
run: |
649-
VERSION="$VERSION"
650649
BRANCH="${GITHUB_REF#refs/heads/}"
651650
COMMIT="${GITHUB_SHA}"
652-
RELEASE_NOTES="${{github.server_url}}/${{github.repository}}/releases"
651+
RELEASE_NOTES="$RELEASES_URL"
653652
$RELEASE && RELEASE_NOTES+="/tag/$BRANCH"
654653
echo "NUSPEC_PROPERTIES=version=$VERSION;branch=$BRANCH;commit=$COMMIT;releaseNotes=$RELEASE_NOTES" >> "$GITHUB_ENV"
655654
env:
656655
VERSION: ${{ github.event.inputs.version || '0.0.0.0' }}
657656
RELEASE: ${{ github.event.inputs.release }}
658657
BRANCH: ${{ github.event.inputs.branch }}
658+
RELEASES_URL: ${{ format('{0}/{1}/releases', github.server_url, github.repository) }}
659659
- name: Pack
660660
shell: bash
661661
run: |
@@ -671,9 +671,9 @@ jobs:
671671
path: '*.nupkg'
672672
- name: Push to nuget.org
673673
if: env.NUGET_API_KEY && startsWith(github.event.inputs.branch, 'chromium/') && github.event.inputs.version && github.event.inputs.nuget == 'true'
674-
run: nuget push -Source nuget.org -ApiKey ${{ secrets.NUGET_API_KEY }} *.nupkg
674+
run: nuget push -Source nuget.org -ApiKey "$NUGET_API_KEY" *.nupkg
675675
env:
676-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
676+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
677677

678678
conda:
679679
name: Conda packages
@@ -817,7 +817,7 @@ jobs:
817817
continue-on-error: true
818818
run: |
819819
CURRENT_REV=$BRANCH
820-
PREVIOUS_REV=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r ".tag_name")
820+
PREVIOUS_REV=$(curl --silent "$LATEST_RELEASE_URL" | jq -r ".tag_name")
821821
git clone -b "$BRANCH" https://pdfium.googlesource.com/pdfium.git
822822
cat <<END >> RELEASE.md
823823
### Changes
@@ -826,6 +826,7 @@ jobs:
826826
git -C "pdfium" log origin/${PREVIOUS_REV}.. --pretty=format:'* [%s](https://pdfium.googlesource.com/pdfium/+/%H)' >> RELEASE.md
827827
env:
828828
BRANCH: ${{ github.event.inputs.branch }}
829+
LATEST_RELEASE_URL: ${{ format('{0}/{1}/releases/latest', github.server_url, github.repository) }}
829830
- name: Generate artifacts checksums
830831
id: hash
831832
run: echo "hashes=$(sha256sum pdfium-*.tgz | base64 -w0)" >> "$GITHUB_OUTPUT"
@@ -835,7 +836,9 @@ jobs:
835836
with:
836837
subject-path: pdfium-*.tgz
837838
- name: Rename provenance file
838-
run: mv "${{ steps.provenance.outputs.bundle-path }}" pdfium-attestation.json
839+
run: mv "$BUNDLE_PATH" pdfium-attestation.json
840+
env:
841+
BUNDLE_PATH: ${{ steps.provenance.outputs.bundle-path }}
839842
- name: Publish Release
840843
uses: ncipollo/release-action@v1
841844
with:

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ jobs:
7676
[ "$PDFium_TARGET_OS" != "emscripten" ] && ARTIFACT="$ARTIFACT-$PDFium_TARGET_OS"
7777
[ "$PDFium_TARGET_ENVIRONMENT" != "" ] && ARTIFACT="$ARTIFACT-$PDFium_TARGET_ENVIRONMENT"
7878
ARTIFACT="$ARTIFACT-$PDFium_TARGET_CPU"
79-
[ "${{inputs.is_debug}}" == "true" ] && ARTIFACT="$ARTIFACT-debug"
79+
[ "$IS_DEBUG" == "true" ] && ARTIFACT="$ARTIFACT-debug"
8080
echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT
81+
env:
82+
IS_DEBUG: ${{ inputs.is_debug }}
8183
- name: Checkout this repo
8284
uses: actions/checkout@v6
8385
with:

.github/workflows/patch.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,15 @@ jobs:
9090
run: |
9191
{
9292
echo "## Rejected patches";
93-
echo "The following patches for the configuration ${{ matrix.os }} ${{ matrix.cpu }} ${{ matrix.v8 && 'v8' || '' }} ${{ matrix.environment || '' }} were rejected:";
93+
echo "The following patches for the configuration $TARGET_OS $TARGET_CPU $ENABLE_V8 $TARGET_ENVIRONMENT were rejected:";
9494
find pdfium -name '*.rej' -type f \
9595
-printf '### `%P`\n```patch\n' \
9696
-exec cat {} \; \
9797
-printf '```\n' || \
9898
echo 'No .rej files found';
9999
} >> $GITHUB_STEP_SUMMARY
100+
env:
101+
TARGET_OS: ${{ matrix.os }}
102+
TARGET_CPU: ${{ matrix.cpu }}
103+
ENABLE_V8: ${{ matrix.v8 && 'v8' || '' }}
104+
TARGET_ENVIRONMENT: ${{ matrix.environment || '' }}

0 commit comments

Comments
 (0)