Skip to content

Commit a54df25

Browse files
fix: address PR review — sign by digest, tighten identity, fix docs
- Sign images by immutable digest from build-push-action output instead of mutable tags to eliminate TOCTOU risk - Tighten cosign certificate identity to the specific release workflow path and tag refs - Parameterize IMAGE in Makefile verify-image target to support both initium and initium-jyq variants - Clarify docs: SBOM attestations are cosign-signed, provenance is generated by BuildKit (not cosign-signed) - Use version tags instead of :latest in doc examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 10f0a77 commit a54df25

3 files changed

Lines changed: 40 additions & 35 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
id: version
4040
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
4141
- uses: docker/build-push-action@v6
42+
id: build-main
4243
with:
4344
context: .
4445
platforms: linux/amd64,linux/arm64
@@ -53,13 +54,14 @@ jobs:
5354
sbom: true
5455
provenance: true
5556
- name: Sign initium image
56-
run: |
57-
cosign sign --yes ghcr.io/kitstream/initium:${{ steps.version.outputs.VERSION }}
58-
cosign sign --yes ghcr.io/kitstream/initium:latest
57+
run: cosign sign --yes ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }}
5958
- name: SBOM attestation for initium image
6059
run: |
61-
cosign attest --yes --predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium:${{ steps.version.outputs.VERSION }} --format '{{json .SBOM.SPDX}}') --type spdx ghcr.io/kitstream/initium:${{ steps.version.outputs.VERSION }}
60+
cosign attest --yes --type spdx \
61+
--predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }} --format '{{json .SBOM.SPDX}}') \
62+
ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }}
6263
- uses: docker/build-push-action@v6
64+
id: build-jyq
6365
with:
6466
context: .
6567
file: Dockerfile.jyq
@@ -75,9 +77,9 @@ jobs:
7577
sbom: true
7678
provenance: true
7779
- name: Sign initium-jyq image
78-
run: |
79-
cosign sign --yes ghcr.io/kitstream/initium-jyq:${{ steps.version.outputs.VERSION }}
80-
cosign sign --yes ghcr.io/kitstream/initium-jyq:latest
80+
run: cosign sign --yes ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }}
8181
- name: SBOM attestation for initium-jyq image
8282
run: |
83-
cosign attest --yes --predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium-jyq:${{ steps.version.outputs.VERSION }} --format '{{json .SBOM.SPDX}}') --type spdx ghcr.io/kitstream/initium-jyq:${{ steps.version.outputs.VERSION }}
83+
cosign attest --yes --type spdx \
84+
--predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }} --format '{{json .SBOM.SPDX}}') \
85+
ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }}

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
BINARY := initium
22
VERSION ?= dev
3+
IMAGE ?= ghcr.io/kitstream/initium
4+
COSIGN_IDENTITY := https://github.com/KitStream/initium/.github/workflows/release.yml@refs/tags/v*
35
.PHONY: all build test lint clean verify-image
46
all: lint test build
57
build:
6-
cargo build --release
7-
cp target/release/$(BINARY) bin/$(BINARY)
8+
cargo build --release
9+
cp target/release/$(BINARY) bin/$(BINARY)
810
test:
9-
cargo test
11+
cargo test
1012
lint:
11-
cargo clippy -- -D warnings
12-
cargo fmt --check
13+
cargo clippy -- -D warnings
14+
cargo fmt --check
1315
clean:
14-
cargo clean
15-
rm -rf bin/
16+
cargo clean
17+
rm -rf bin/
1618
docker-build:
17-
docker build -t ghcr.io/kitstream/initium:$(VERSION) .
19+
docker build -t ghcr.io/kitstream/initium:$(VERSION) .
1820
docker-push:
19-
docker push ghcr.io/kitstream/initium:$(VERSION)
21+
docker push ghcr.io/kitstream/initium:$(VERSION)
2022
verify-image:
21-
cosign verify --certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp '^https://github\.com/KitStream/initium/' ghcr.io/kitstream/initium:$(VERSION)
23+
cosign verify --certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity '$(COSIGN_IDENTITY)' $(IMAGE):$(VERSION)

docs/security.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,38 +78,39 @@ If your cluster still uses PSPs, the same security context fields apply. Initium
7878

7979
## Image Verification
8080

81-
Release images are signed with [cosign](https://github.com/sigstore/cosign) using keyless signing (Sigstore OIDC via GitHub Actions). SBOM and provenance attestations are also signed and attached to each image.
81+
Release images are signed with [cosign](https://github.com/sigstore/cosign) using keyless signing (Sigstore OIDC via GitHub Actions). SBOM attestations are signed and attached to each image. Provenance attestations are generated by Docker BuildKit and can be inspected with `docker buildx imagetools`.
8282

8383
### Verify image signature
8484

8585
```bash
8686
# Verify signature (requires cosign)
8787
cosign verify \
8888
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
89-
--certificate-identity-regexp '^https://github\.com/KitStream/initium/' \
90-
ghcr.io/kitstream/initium:latest
89+
--certificate-identity 'https://github.com/KitStream/initium/.github/workflows/release.yml@refs/tags/v*' \
90+
ghcr.io/kitstream/initium:1.3.1
9191
92-
# Or use the Makefile target
93-
make verify-image VERSION=latest
92+
# Or use the Makefile target (also supports IMAGE=ghcr.io/kitstream/initium-jyq)
93+
make verify-image VERSION=1.3.1
9494
```
9595

96-
### Verify attestations
96+
### Verify SBOM attestation
9797

9898
```bash
99-
# Verify provenance
100-
cosign verify-attestation \
101-
--type https://slsa.dev/provenance/v0.2 \
102-
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
103-
--certificate-identity-regexp '^https://github\.com/KitStream/initium/' \
104-
ghcr.io/kitstream/initium:latest
105-
106-
# Verify SBOM attestation
10799
cosign verify-attestation \
108100
--type spdx \
109101
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
110-
--certificate-identity-regexp '^https://github\.com/KitStream/initium/' \
111-
ghcr.io/kitstream/initium:latest
102+
--certificate-identity 'https://github.com/KitStream/initium/.github/workflows/release.yml@refs/tags/v*' \
103+
ghcr.io/kitstream/initium:1.3.1
104+
```
105+
106+
### View provenance and SBOM
107+
108+
Provenance and SBOM attestations are generated by Docker BuildKit during the image build:
109+
110+
```bash
111+
# View provenance
112+
docker buildx imagetools inspect ghcr.io/kitstream/initium:1.3.1 --format '{{json .Provenance}}'
112113
113114
# View SBOM
114-
docker buildx imagetools inspect ghcr.io/kitstream/initium:latest --format '{{json .SBOM}}'
115+
docker buildx imagetools inspect ghcr.io/kitstream/initium:1.3.1 --format '{{json .SBOM}}'
115116
```

0 commit comments

Comments
 (0)