-
Notifications
You must be signed in to change notification settings - Fork 4
1603 lines (1493 loc) · 76.2 KB
/
Copy pathdocker.yml
File metadata and controls
1603 lines (1493 loc) · 76.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Docker
on:
pull_request:
branches: [main]
paths:
- "notify/**"
- ".github/workflows/docker.yml"
- ".github/workflows/ci.yml"
- ".github/workflows/security.yml"
- ".github/scripts/notify-publish-safety.rb"
push:
branches: [main]
paths:
- "notify/**"
- ".github/workflows/docker.yml"
- ".github/workflows/ci.yml"
- ".github/workflows/security.yml"
- ".github/scripts/notify-publish-safety.rb"
workflow_dispatch:
inputs:
release_tag:
description: "Existing notify-vX.Y.Z source tag"
required: true
type: string
confirmation:
description: "Type PUBLISH_NOTIFY_RELEASE to publish images and binaries"
required: true
type: string
recovery_run_id:
description: "Failed tag-bound publication run to resume from main; empty for a normal tag dispatch"
required: false
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && github.actor == github.repository_owner && github.triggering_actor == github.repository_owner && inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' && inputs.release_tag || github.event_name == 'workflow_dispatch' && github.run_id || github.ref }}
# A second owner dispatch queues behind an active publication. It may verify
# and resume identical draft material but must never replace an artifact.
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }}
permissions:
contents: read
env:
RELEASE_SPEC: notify/release.json
IMAGE_NAME: ghcr.io/psimaker/vaultsync-notify
jobs:
publish-safety-policy:
name: Publish Safety Policy
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
persist-credentials: false
- name: Verify publication remains owner-gated and immutable
run: ruby .github/scripts/notify-publish-safety.rb
notify-guard:
name: Notify Guard Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: notify/go.mod
- name: Run notify test suite
working-directory: notify
run: go test ./... -count=1
build-without-push:
name: Build Image (no push)
if: github.event_name != 'workflow_dispatch'
needs:
- publish-safety-policy
- notify-guard
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
persist-credentials: false
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
- name: Build local validation image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
with:
context: notify
load: true
push: false
platforms: linux/amd64
tags: vaultsync-notify:ci-${{ github.sha }}
build-args: |
VERSION=dev-${{ github.sha }}
provenance: false
sbom: false
- name: Verify the minimal runtime image
run: |
set -euo pipefail
image="vaultsync-notify:ci-${GITHUB_SHA}"
test "$(docker image inspect --format '{{.Config.User}}' "$image")" = "65534:65534"
test "$(docker run --rm --network none --read-only --cap-drop ALL \
--security-opt no-new-privileges "$image" --version)" = "vaultsync-notify dev-${GITHUB_SHA}"
if docker run --rm --network none --entrypoint /bin/sh "$image" -c true >/dev/null 2>&1; then
echo "runtime image unexpectedly contains a shell" >&2
exit 1
fi
- name: Scan local validation image
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
image-ref: vaultsync-notify:ci-${{ github.sha }}
scanners: vuln,secret
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: "1"
publish-gate:
name: Owner Publish Gate
if: github.event_name == 'workflow_dispatch'
needs:
- publish-safety-policy
- notify-guard
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: read
outputs:
version: ${{ steps.validate.outputs.version }}
release_tag: ${{ steps.validate.outputs.release_tag }}
release_sha: ${{ steps.validate.outputs.release_sha }}
image: ${{ steps.validate.outputs.image }}
rollback_image: ${{ steps.validate.outputs.rollback_image }}
rollback_commit: ${{ steps.validate.outputs.rollback_commit }}
release_is_public: ${{ steps.validate.outputs.release_is_public }}
recovery_mode: ${{ steps.validate.outputs.recovery_mode }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
persist-credentials: false
- name: Validate owner, manifest, tag, commit, and draft state
id: validate
shell: bash
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
RELEASE_TAG_INPUT: ${{ inputs.release_tag }}
CONFIRMATION: ${{ inputs.confirmation }}
RECOVERY_RUN_ID: ${{ inputs.recovery_run_id }}
ACTOR: ${{ github.actor }}
TRIGGERING_ACTOR: ${{ github.triggering_actor }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
WORKFLOW_SHA: ${{ github.sha }}
run: |
set -euo pipefail
test "$EVENT_NAME" = workflow_dispatch
test "$ACTOR" = "$REPOSITORY_OWNER"
test "$TRIGGERING_ACTOR" = "$REPOSITORY_OWNER"
test "$CONFIRMATION" = PUBLISH_NOTIFY_RELEASE
version=$(jq -er '.version | select(test("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"))' "$RELEASE_SPEC")
release_tag=$(jq -er '.tag' "$RELEASE_SPEC")
image=$(jq -er '.image' "$RELEASE_SPEC")
version_image=$(jq -er '.version_image' "$RELEASE_SPEC")
rollback_tag=$(jq -er '.rollback.tag' "$RELEASE_SPEC")
rollback_commit=$(jq -er '.rollback.commit | select(test("^[0-9a-f]{40}$"))' "$RELEASE_SPEC")
rollback_image=$(jq -er '.rollback.image | select(test("^ghcr\\.io/psimaker/vaultsync-notify@sha256:[0-9a-f]{64}$"))' "$RELEASE_SPEC")
test "$release_tag" = "notify-v${version}"
test "$image" = "$IMAGE_NAME"
test "$version_image" = "${IMAGE_NAME}:${version}"
test "$RELEASE_TAG_INPUT" = "$release_tag"
git fetch origin main --tags
test "$(git cat-file -t "refs/tags/${release_tag}")" = commit
resolved=$(git rev-parse --verify "refs/tags/${release_tag}^{commit}")
git show-ref --verify --quiet refs/remotes/origin/main
git merge-base --is-ancestor "$resolved" refs/remotes/origin/main
test "$(gh api "repos/${GITHUB_REPOSITORY}/commits/${resolved}" --jq .commit.verification.verified)" = true
recovery_mode=false
case "$REF_TYPE" in
tag)
test "$REF_NAME" = "$release_tag"
test -z "$RECOVERY_RUN_ID"
test "$WORKFLOW_SHA" = "$resolved"
;;
branch)
test "$REF_NAME" = main
printf '%s\n' "$RECOVERY_RUN_ID" | grep -Eq '^[1-9][0-9]*$'
test "$WORKFLOW_SHA" = "$(git rev-parse refs/remotes/origin/main)"
test "$(gh api "repos/${GITHUB_REPOSITORY}/commits/${WORKFLOW_SHA}" --jq .commit.verification.verified)" = true
recovery_json=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${RECOVERY_RUN_ID}")
test "$(jq -r .id <<<"$recovery_json")" = "$RECOVERY_RUN_ID"
test "$(jq -r .event <<<"$recovery_json")" = workflow_dispatch
test "$(jq -r .path <<<"$recovery_json")" = .github/workflows/docker.yml
test "$(jq -r .head_branch <<<"$recovery_json")" = "$release_tag"
test "$(jq -r .head_sha <<<"$recovery_json")" = "$resolved"
test "$(jq -r .conclusion <<<"$recovery_json")" = failure
test "$(jq -r .actor.login <<<"$recovery_json")" = "$REPOSITORY_OWNER"
test "$(jq -r .triggering_actor.login <<<"$recovery_json")" = "$REPOSITORY_OWNER"
recovery_jobs=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${RECOVERY_RUN_ID}/jobs?per_page=100")
test "$(jq '[.jobs[] | select(.name == "Stage Release Binaries" and .conclusion == "failure")] | length' <<<"$recovery_jobs")" = 1
test "$(jq '[.jobs[] | select(.name == "Stage Release Binaries") | .steps[] | select(.name == "Create or verify the exact draft release and assets" and .conclusion == "failure")] | length' <<<"$recovery_jobs")" = 1
test "$(jq '[.jobs[] | select(.name == "Publish Image" and .conclusion == "success")] | length' <<<"$recovery_jobs")" = 1
test "$(jq '[.jobs[] | select(.name == "Published Helper Rollout" and .conclusion == "skipped")] | length' <<<"$recovery_jobs")" = 1
test "$(jq '[.jobs[] | select(.name == "Finalize Helper Release" and .conclusion == "skipped")] | length' <<<"$recovery_jobs")" = 1
recovery_mode=true
;;
*) exit 1 ;;
esac
test "$(git rev-parse --verify "refs/tags/${rollback_tag}^{commit}")" = "$rollback_commit"
gh release view "$rollback_tag" --repo "$GITHUB_REPOSITORY" >/dev/null
release_is_public=false
repository_name=${GITHUB_REPOSITORY#*/}
test "$GITHUB_REPOSITORY" = "${REPOSITORY_OWNER}/${repository_name}"
# GraphQL variables must remain literal for gh.
# shellcheck disable=SC2016
release_lookup=$(gh api graphql \
-F owner="$REPOSITORY_OWNER" -F name="$repository_name" -F tag="$release_tag" \
-f query='query($owner: String!, $name: String!, $tag: String!) {
repository(owner: $owner, name: $name) {
release(tagName: $tag) { tagName isDraft isPrerelease publishedAt }
}
}')
jq -e '.data.repository != null and ((.errors // []) | length == 0)' <<<"$release_lookup" >/dev/null
release_json=$(jq -c '.data.repository.release' <<<"$release_lookup")
release_type=$(jq -r 'type' <<<"$release_json")
case $release_type in
null) ;;
object)
test "$(jq -r .tagName <<<"$release_json")" = "$release_tag"
test "$(jq -r .isPrerelease <<<"$release_json")" = false
case $(jq -r .isDraft <<<"$release_json") in
true) ;;
false)
jq -er '.publishedAt | select(type == "string" and length > 0)' <<<"$release_json" >/dev/null
release_is_public=true
;;
*) exit 1 ;;
esac
;;
*) exit 1 ;;
esac
if [ "$recovery_mode" = true ] && [ "$release_type" = null ]; then
# GitHub exposes draft releases only to tokens with push access. Keep
# this gate read-only; release-binaries resolves the exact draft with
# its isolated contents:write token and refuses to recreate a missing
# draft during recovery before performing any release mutation.
echo "Draft visibility deferred to the exact recovery staging gate."
fi
manifest_digest=$(sha256sum "$RELEASE_SPEC" | awk '{print $1}')
git checkout --detach "$resolved"
test "$(sha256sum "$RELEASE_SPEC" | awk '{print $1}')" = "$manifest_digest"
{
echo "version=$version"
echo "release_tag=$release_tag"
echo "release_sha=$resolved"
echo "image=$image"
echo "rollback_image=$rollback_image"
echo "rollback_commit=$rollback_commit"
echo "release_is_public=$release_is_public"
echo "recovery_mode=$recovery_mode"
} >> "$GITHUB_OUTPUT"
- name: Scan the exact helper source before any publication mutation
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: fs
scan-ref: notify
scanners: vuln,secret
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: "1"
publish-image:
name: Publish Image
if: >-
github.event_name == 'workflow_dispatch' &&
github.ref_type == 'tag' &&
inputs.release_tag == github.ref_name &&
inputs.recovery_run_id == '' &&
inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' &&
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner
needs:
- publish-safety-policy
- notify-guard
- publish-gate
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
id-token: write
attestations: write
outputs:
digest: ${{ steps.select-image.outputs.digest }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
ref: ${{ needs.publish-gate.outputs.release_sha }}
persist-credentials: false
- uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Detect an existing exact release image
id: existing-image
env:
IMAGE: ${{ needs.publish-gate.outputs.image }}
VERSION: ${{ needs.publish-gate.outputs.version }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_IS_PUBLIC: ${{ needs.publish-gate.outputs.release_is_public }}
run: |
set -euo pipefail
token=$(curl -fsSL "https://ghcr.io/token?scope=repository:psimaker/vaultsync-notify:pull" | jq -er .token)
http_status=$(curl -sS -o /tmp/vaultsync-notify-version-manifest.json -w '%{http_code}' \
-H "Authorization: Bearer $token" \
-H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json' \
"https://ghcr.io/v2/psimaker/vaultsync-notify/manifests/${VERSION}")
if [ "$http_status" = 200 ]; then
manifest=$(docker buildx imagetools inspect "${IMAGE}:${VERSION}" --format '{{json .Manifest}}')
digest=$(jq -er '.digest | select(test("^sha256:[0-9a-f]{64}$"))' <<<"$manifest")
docker pull "${IMAGE}@${digest}" >/dev/null
test "$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' "${IMAGE}@${digest}")" = "$RELEASE_SHA"
test "$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.version"}}' "${IMAGE}@${digest}")" = "$VERSION"
test "$(docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges "${IMAGE}@${digest}" --version)" = "vaultsync-notify $VERSION"
echo "present=true" >> "$GITHUB_OUTPUT"
echo "digest=$digest" >> "$GITHUB_OUTPUT"
elif [ "$http_status" = 404 ]; then
if [ "$RELEASE_IS_PUBLIC" = true ]; then
echo "public release image is missing; refusing to publish on a finalized release" >&2
exit 1
fi
echo "present=false" >> "$GITHUB_OUTPUT"
else
echo "GHCR lookup failed with HTTP ${http_status}; refusing to treat the version tag as absent" >&2
exit 1
fi
- name: Derive version-only image metadata
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6
id: meta
with:
images: ${{ needs.publish-gate.outputs.image }}
tags: |
type=raw,value=${{ needs.publish-gate.outputs.version }}
- name: Build and publish the absent release image
if: >-
needs.publish-gate.outputs.release_is_public != 'true' &&
steps.existing-image.outputs.present != 'true'
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
id: build
with:
context: notify
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ needs.publish-gate.outputs.version }}
provenance: mode=max
sbom: true
- name: Select and revalidate the immutable image digest
id: select-image
env:
IMAGE: ${{ needs.publish-gate.outputs.image }}
VERSION: ${{ needs.publish-gate.outputs.version }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
EXISTING_DIGEST: ${{ steps.existing-image.outputs.digest }}
BUILT_DIGEST: ${{ steps.build.outputs.digest }}
run: |
set -euo pipefail
digest=${BUILT_DIGEST:-$EXISTING_DIGEST}
printf '%s\n' "$digest" | grep -Eq '^sha256:[0-9a-f]{64}$'
current=$(docker buildx imagetools inspect "${IMAGE}:${VERSION}" --format '{{json .Manifest}}' | jq -er .digest)
test "$current" = "$digest"
docker pull "${IMAGE}@${digest}" >/dev/null
test "$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' "${IMAGE}@${digest}")" = "$RELEASE_SHA"
test "$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.version"}}' "${IMAGE}@${digest}")" = "$VERSION"
test "$(docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges "${IMAGE}@${digest}" --version)" = "vaultsync-notify $VERSION"
echo "digest=$digest" >> "$GITHUB_OUTPUT"
- name: Scan published image
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
image-ref: ${{ needs.publish-gate.outputs.image }}@${{ steps.select-image.outputs.digest }}
scanners: vuln,secret
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: "1"
- name: Create the image SPDX SBOM
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: image
image-ref: ${{ needs.publish-gate.outputs.image }}@${{ steps.select-image.outputs.digest }}
format: spdx-json
output: /tmp/vaultsync-notify-image.spdx.json
- name: Check for existing repository provenance
id: image-provenance
env:
GH_TOKEN: ${{ github.token }}
IMAGE: ${{ needs.publish-gate.outputs.image }}
DIGEST: ${{ steps.select-image.outputs.digest }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_IS_PUBLIC: ${{ needs.publish-gate.outputs.release_is_public }}
run: |
set -euo pipefail
if gh attestation verify "oci://${IMAGE}@${DIGEST}" --repo "$GITHUB_REPOSITORY" \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null 2>&1; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
if [ "$RELEASE_IS_PUBLIC" = true ]; then
echo "public image provenance is missing or mismatched; refusing to create it" >&2
exit 1
fi
echo "present=false" >> "$GITHUB_OUTPUT"
fi
- name: Attest image provenance
if: >-
needs.publish-gate.outputs.release_is_public != 'true' &&
steps.image-provenance.outputs.present != 'true'
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-name: ${{ needs.publish-gate.outputs.image }}
subject-digest: ${{ steps.select-image.outputs.digest }}
push-to-registry: true
- name: Check for existing repository SBOM attestation
id: image-sbom
env:
GH_TOKEN: ${{ github.token }}
IMAGE: ${{ needs.publish-gate.outputs.image }}
DIGEST: ${{ steps.select-image.outputs.digest }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_IS_PUBLIC: ${{ needs.publish-gate.outputs.release_is_public }}
run: |
set -euo pipefail
if gh attestation verify "oci://${IMAGE}@${DIGEST}" --repo "$GITHUB_REPOSITORY" \
--predicate-type https://spdx.dev/Document/v2.3 \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null 2>&1; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
if [ "$RELEASE_IS_PUBLIC" = true ]; then
echo "public image SBOM attestation is missing or mismatched; refusing to create it" >&2
exit 1
fi
echo "present=false" >> "$GITHUB_OUTPUT"
fi
- name: Attest image SBOM
if: >-
needs.publish-gate.outputs.release_is_public != 'true' &&
steps.image-sbom.outputs.present != 'true'
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-name: ${{ needs.publish-gate.outputs.image }}
subject-digest: ${{ steps.select-image.outputs.digest }}
sbom-path: /tmp/vaultsync-notify-image.spdx.json
push-to-registry: true
recover-image:
name: Recover Published Image (read-only)
if: >-
github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/main' &&
inputs.recovery_run_id != '' &&
inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' &&
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner
needs:
- publish-safety-policy
- notify-guard
- publish-gate
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
packages: read
outputs:
digest: ${{ steps.verify-image.outputs.digest }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
ref: ${{ needs.publish-gate.outputs.release_sha }}
persist-credentials: false
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Verify the immutable recovery image and attestations
id: verify-image
env:
GH_TOKEN: ${{ github.token }}
IMAGE: ${{ needs.publish-gate.outputs.image }}
VERSION: ${{ needs.publish-gate.outputs.version }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
run: |
set -euo pipefail
manifest=$(docker buildx imagetools inspect "${IMAGE}:${VERSION}" --format '{{json .Manifest}}')
digest=$(jq -er '.digest | select(test("^sha256:[0-9a-f]{64}$"))' <<<"$manifest")
test "$(jq '[.manifests[] | select(.platform.os == "linux" and .platform.architecture == "amd64")] | length' <<<"$manifest")" = 1
test "$(jq '[.manifests[] | select(.platform.os == "linux" and .platform.architecture == "arm64")] | length' <<<"$manifest")" = 1
docker pull "${IMAGE}@${digest}" >/dev/null
test "$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' "${IMAGE}@${digest}")" = "$RELEASE_SHA"
test "$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.version"}}' "${IMAGE}@${digest}")" = "$VERSION"
test "$(docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges "${IMAGE}@${digest}" --version)" = "vaultsync-notify $VERSION"
gh attestation verify "oci://${IMAGE}@${digest}" --repo "$GITHUB_REPOSITORY" \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null
gh attestation verify "oci://${IMAGE}@${digest}" --repo "$GITHUB_REPOSITORY" \
--predicate-type https://spdx.dev/Document/v2.3 \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null
echo "digest=$digest" >> "$GITHUB_OUTPUT"
- name: Scan the immutable recovery image
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
image-ref: ${{ needs.publish-gate.outputs.image }}@${{ steps.verify-image.outputs.digest }}
scanners: vuln,secret
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: "1"
image-ready:
name: Select Immutable Helper Image
if: >-
always() &&
github.event_name == 'workflow_dispatch' &&
inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' &&
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner &&
needs.publish-safety-policy.result == 'success' &&
needs.notify-guard.result == 'success' &&
needs.publish-gate.result == 'success' &&
((needs.publish-gate.outputs.recovery_mode == 'true' &&
needs.recover-image.result == 'success' && needs.publish-image.result == 'skipped') ||
(needs.publish-gate.outputs.recovery_mode != 'true' &&
needs.publish-image.result == 'success' && needs.recover-image.result == 'skipped'))
needs:
- publish-safety-policy
- notify-guard
- publish-gate
- publish-image
- recover-image
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
outputs:
digest: ${{ steps.select.outputs.digest }}
steps:
- name: Select the only eligible immutable digest
id: select
env:
RECOVERY_MODE: ${{ needs.publish-gate.outputs.recovery_mode }}
PUBLISHED_DIGEST: ${{ needs.publish-image.outputs.digest }}
RECOVERED_DIGEST: ${{ needs.recover-image.outputs.digest }}
run: |
set -euo pipefail
if [ "$RECOVERY_MODE" = true ]; then
test -z "$PUBLISHED_DIGEST"
digest=$RECOVERED_DIGEST
else
test -z "$RECOVERED_DIGEST"
digest=$PUBLISHED_DIGEST
fi
printf '%s\n' "$digest" | grep -Eq '^sha256:[0-9a-f]{64}$'
echo "digest=$digest" >> "$GITHUB_OUTPUT"
attest-binaries:
name: Attest Release Binaries
if: >-
always() &&
github.event_name == 'workflow_dispatch' &&
github.ref_type == 'tag' &&
inputs.release_tag == github.ref_name &&
inputs.recovery_run_id == '' &&
inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' &&
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner &&
needs.publish-safety-policy.result == 'success' &&
needs.notify-guard.result == 'success' &&
needs.publish-gate.result == 'success' &&
needs.image-ready.result == 'success'
needs:
- publish-safety-policy
- notify-guard
- publish-gate
- image-ready
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
ref: ${{ needs.publish-gate.outputs.release_sha }}
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: notify/go.mod
cache: false
- name: Cross-compile every binary twice for attestation
working-directory: notify
env:
RELEASE_VERSION: ${{ needs.publish-gate.outputs.version }}
run: |
set -euo pipefail
rm -rf dist verify-dist
mkdir -p dist verify-dist
mapfile -t binaries < <(jq -r '.binaries[]' release.json)
for output_directory in dist verify-dist; do
for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
goos=${target%/*}
goarch=${target#*/}
out="${output_directory}/vaultsync-notify_${goos}_${goarch}"
[ "$goos" = windows ] && out="$out.exe"
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 go build -trimpath -buildvcs=false \
-ldflags="-s -w -X main.version=${RELEASE_VERSION}" -o "$out" .
done
done
for name in "${binaries[@]}"; do
cmp "dist/$name" "verify-dist/$name"
done
(cd dist && sha256sum -- "${binaries[@]}" > SHA256SUMS)
- name: Scan attested binaries for vulnerabilities and secrets
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: rootfs
scan-ref: notify/dist
scanners: vuln,secret
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: "1"
- name: Create deterministic attestation SPDX SBOM
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: rootfs
scan-ref: notify/dist
format: spdx-json
output: notify/dist/SBOM.spdx.json
- name: Normalize deterministic attestation SBOM metadata
env:
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
run: |
set -euo pipefail
jq --arg namespace "https://github.com/${GITHUB_REPOSITORY}/sbom/${RELEASE_TAG}/${RELEASE_SHA}" \
'.creationInfo.created = "1970-01-01T00:00:00Z"
| .documentNamespace = $namespace
| walk(if type == "object" and has("annotationDate")
then .annotationDate = "1970-01-01T00:00:00Z"
else . end)' \
notify/dist/SBOM.spdx.json > /tmp/SBOM.spdx.json
mv /tmp/SBOM.spdx.json notify/dist/SBOM.spdx.json
- name: Check for existing exact binary provenance
id: binary-provenance
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_IS_PUBLIC: ${{ needs.publish-gate.outputs.release_is_public }}
run: |
set -euo pipefail
present=true
while IFS= read -r name; do
if ! gh attestation verify "notify/dist/$name" --repo "$GITHUB_REPOSITORY" \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null 2>&1; then
present=false
fi
done < <(jq -r '.binaries[]' "$RELEASE_SPEC")
if [ "$RELEASE_IS_PUBLIC" = true ] && [ "$present" != true ]; then
echo "public binary provenance is missing or mismatched; refusing to create it" >&2
exit 1
fi
echo "present=$present" >> "$GITHUB_OUTPUT"
- name: Attest binary provenance
if: >-
needs.publish-gate.outputs.release_is_public != 'true' &&
steps.binary-provenance.outputs.present != 'true'
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-path: notify/dist/vaultsync-notify_*
- name: Check for existing exact binary SBOM attestation
id: binary-sbom
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_IS_PUBLIC: ${{ needs.publish-gate.outputs.release_is_public }}
run: |
set -euo pipefail
present=true
while IFS= read -r name; do
if ! gh attestation verify "notify/dist/$name" --repo "$GITHUB_REPOSITORY" \
--predicate-type https://spdx.dev/Document/v2.3 \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null 2>&1; then
present=false
fi
done < <(jq -r '.binaries[]' "$RELEASE_SPEC")
if [ "$RELEASE_IS_PUBLIC" = true ] && [ "$present" != true ]; then
echo "public binary SBOM attestation is missing or mismatched; refusing to create it" >&2
exit 1
fi
echo "present=$present" >> "$GITHUB_OUTPUT"
- name: Attest binary SBOM
if: >-
needs.publish-gate.outputs.release_is_public != 'true' &&
steps.binary-sbom.outputs.present != 'true'
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-path: notify/dist/vaultsync-notify_*
sbom-path: notify/dist/SBOM.spdx.json
binary-attestation-ready:
name: Require Immutable Binary Attestations
if: >-
always() &&
github.event_name == 'workflow_dispatch' &&
inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' &&
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner &&
needs.publish-safety-policy.result == 'success' &&
needs.notify-guard.result == 'success' &&
needs.publish-gate.result == 'success' &&
needs.image-ready.result == 'success' &&
((needs.publish-gate.outputs.recovery_mode == 'true' &&
needs.attest-binaries.result == 'skipped') ||
(needs.publish-gate.outputs.recovery_mode != 'true' &&
needs.attest-binaries.result == 'success'))
needs:
- publish-safety-policy
- notify-guard
- publish-gate
- image-ready
- attest-binaries
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Confirm the only eligible attestation path
env:
RECOVERY_MODE: ${{ needs.publish-gate.outputs.recovery_mode }}
ATTESTATION_RESULT: ${{ needs.attest-binaries.result }}
run: |
set -euo pipefail
if [ "$RECOVERY_MODE" = true ]; then
test "$ATTESTATION_RESULT" = skipped
else
test "$ATTESTATION_RESULT" = success
fi
release-binaries:
name: Stage Release Binaries
if: >-
always() &&
github.event_name == 'workflow_dispatch' &&
((github.ref_type == 'tag' && inputs.release_tag == github.ref_name && inputs.recovery_run_id == '') ||
(github.ref == 'refs/heads/main' && inputs.recovery_run_id != '')) &&
inputs.confirmation == 'PUBLISH_NOTIFY_RELEASE' &&
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner &&
needs.publish-safety-policy.result == 'success' &&
needs.notify-guard.result == 'success' &&
needs.publish-gate.result == 'success' &&
needs.image-ready.result == 'success' &&
needs.binary-attestation-ready.result == 'success'
needs:
- publish-safety-policy
- notify-guard
- publish-gate
- image-ready
- binary-attestation-ready
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
ref: ${{ needs.publish-gate.outputs.release_sha }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: notify/go.mod
cache: false
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
- name: Cross-compile every binary twice
working-directory: notify
env:
RELEASE_VERSION: ${{ needs.publish-gate.outputs.version }}
run: |
set -euo pipefail
rm -rf dist verify-dist
mkdir -p dist verify-dist
mapfile -t binaries < <(jq -r '.binaries[]' release.json)
for output_directory in dist verify-dist; do
for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
goos=${target%/*}
goarch=${target#*/}
out="${output_directory}/vaultsync-notify_${goos}_${goarch}"
[ "$goos" = windows ] && out="$out.exe"
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 go build -trimpath -buildvcs=false \
-ldflags="-s -w -X main.version=${RELEASE_VERSION}" -o "$out" .
done
done
for name in "${binaries[@]}"; do
cmp "dist/$name" "verify-dist/$name"
done
(cd dist && sha256sum -- "${binaries[@]}" > SHA256SUMS)
- name: Scan release binaries for vulnerabilities and secrets
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: rootfs
scan-ref: notify/dist
scanners: vuln,secret
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: "1"
- name: Create deterministic binary-set SPDX SBOM
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: rootfs
scan-ref: notify/dist
format: spdx-json
output: notify/dist/SBOM.spdx.json
- name: Normalize deterministic SBOM metadata
env:
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
run: |
set -euo pipefail
jq --arg namespace "https://github.com/${GITHUB_REPOSITORY}/sbom/${RELEASE_TAG}/${RELEASE_SHA}" \
'.creationInfo.created = "1970-01-01T00:00:00Z"
| .documentNamespace = $namespace
| walk(if type == "object" and has("annotationDate")
then .annotationDate = "1970-01-01T00:00:00Z"
else . end)' \
notify/dist/SBOM.spdx.json > /tmp/SBOM.spdx.json
mv /tmp/SBOM.spdx.json notify/dist/SBOM.spdx.json
- name: Verify and adopt the immutable staged SBOM in recovery
if: needs.publish-gate.outputs.recovery_mode == 'true'
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
RELEASE_VERSION: ${{ needs.publish-gate.outputs.version }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
run: |
set -euo pipefail
repository_owner=${GITHUB_REPOSITORY%%/*}
repository_name=${GITHUB_REPOSITORY#*/}
# GraphQL includes drafts; REST by-tag does not.
# shellcheck disable=SC2016
lookup=$(gh api graphql \
-F owner="$repository_owner" -F name="$repository_name" -F tag="$RELEASE_TAG" \
-f query='query($owner: String!, $name: String!, $tag: String!) {
repository(owner: $owner, name: $name) {
release(tagName: $tag) { databaseId }
}
}')
jq -e '.data.repository != null and ((.errors // []) | length == 0)' <<<"$lookup" >/dev/null
release_id=$(jq -r '.data.repository.release.databaseId // empty' <<<"$lookup")
printf '%s\n' "$release_id" | grep -Eq '^[1-9][0-9]*$'
release_json=$(gh api "repos/${GITHUB_REPOSITORY}/releases/${release_id}")
test "$(jq -r .tag_name <<<"$release_json")" = "$RELEASE_TAG"
test "$(jq -r .name <<<"$release_json")" = "vaultsync-notify ${RELEASE_VERSION}"
test "$(jq -r .prerelease <<<"$release_json")" = false
case $(jq -r .draft <<<"$release_json") in true|false) ;; *) exit 1 ;; esac
asset_name=SBOM.spdx.json
matches=$(jq -r --arg name "$asset_name" '[.assets[] | select(.name == $name)] | length' <<<"$release_json")
test "$matches" = 1
asset_id=$(jq -r --arg name "$asset_name" '.assets[] | select(.name == $name) | .id' <<<"$release_json")
asset_digest=$(jq -r --arg name "$asset_name" '.assets[] | select(.name == $name) | .digest' <<<"$release_json")
printf '%s\n' "$asset_id" | grep -Eq '^[1-9][0-9]*$'
printf '%s\n' "$asset_digest" | grep -Eq '^sha256:[0-9a-f]{64}$'
staged=/tmp/vaultsync-notify-staged-SBOM.spdx.json
gh api --method GET -H 'Accept: application/octet-stream' \
"repos/${GITHUB_REPOSITORY}/releases/assets/${asset_id}" > "$staged"
test "sha256:$(sha256sum "$staged" | awk '{print $1}')" = "$asset_digest"
generated=notify/dist/SBOM.spdx.json
namespace="https://github.com/${GITHUB_REPOSITORY}/sbom/${RELEASE_TAG}/${RELEASE_SHA}"
for candidate in "$generated" "$staged"; do
jq -e --arg namespace "$namespace" '
.spdxVersion == "SPDX-2.3" and
.dataLicense == "CC0-1.0" and
.name == "notify/dist" and
.documentNamespace == $namespace and
.creationInfo.created == "1970-01-01T00:00:00Z" and
(.creationInfo.creators | index("Tool: trivy-0.70.0") != null)
' "$candidate" >/dev/null
done
canonical_filter='walk(if type == "object" and has("annotationDate")
then .annotationDate = "1970-01-01T00:00:00Z"
else . end)'
jq -S "$canonical_filter" "$generated" > /tmp/vaultsync-notify-generated-SBOM.canonical.json
jq -S "$canonical_filter" "$staged" > /tmp/vaultsync-notify-staged-SBOM.canonical.json
cmp /tmp/vaultsync-notify-generated-SBOM.canonical.json \
/tmp/vaultsync-notify-staged-SBOM.canonical.json
mv "$staged" "$generated"
- name: Verify exact binary provenance
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
run: |
set -euo pipefail
while IFS= read -r name; do
if ! gh attestation verify "notify/dist/$name" --repo "$GITHUB_REPOSITORY" \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null 2>&1; then
echo "immutable binary provenance is missing or mismatched for $name" >&2
exit 1
fi
done < <(jq -r '.binaries[]' "$RELEASE_SPEC")
- name: Verify exact binary SBOM attestation
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ needs.publish-gate.outputs.release_sha }}
RELEASE_TAG: ${{ needs.publish-gate.outputs.release_tag }}
run: |
set -euo pipefail
while IFS= read -r name; do
if ! gh attestation verify "notify/dist/$name" --repo "$GITHUB_REPOSITORY" \
--predicate-type https://spdx.dev/Document/v2.3 \
--source-digest "$RELEASE_SHA" --source-ref "refs/tags/${RELEASE_TAG}" \
--signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/docker.yml" >/dev/null 2>&1; then
echo "immutable binary SBOM attestation is missing or mismatched for $name" >&2
exit 1
fi