Skip to content

Commit 41a9bd4

Browse files
committed
Do not generate provenance on PR builds
It does not make sense to do so; nor do PR submitters have permission to do so. We can't write attestations to `php/pie` in an unprivileged context, otherwise anyone could send a PR with malicious code, store attestation that `php/pie` built the PHAR, and it would look genuine.
1 parent 8156273 commit 41a9bd4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/build-phar.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ jobs:
4848
- name: Check the PHAR executes
4949
run: php pie.phar --version
5050
- name: Generate build provenance attestation
51+
# It does not make sense to do this for PR builds, nor do contributors
52+
# have permission to do. We can't write attestations to `php/pie` in an
53+
# unprivileged context, otherwise anyone could send a PR with malicious
54+
# code, which would store attestation that `php/pie` built the PHAR, and
55+
# it would look genuine. So this should NOT run for PR builds.
56+
if: github.event_name != 'pull_request'
5157
uses: actions/attest-build-provenance@v1
5258
with:
5359
subject-path: '${{ github.workspace }}/pie.phar'

0 commit comments

Comments
 (0)