Code to Production 04: Image Gates and the Supply Chain¶
An image that hasn't run, been scanned and been signed doesn't exist in eShop's registry, and an image the pipeline's key didn't sign doesn't start in the cluster. One CI job does the first half, one admission webhook does the second. This post walks both, with the real logs and the four pitfalls the setup guards against.
Code to Production: the series
- The system on one page
- Ways of working
- CI gates before review
- Image gates and the supply chain (this post)
- Delivery and releases
- The platform
- Observability
- Operations and caveats
One job builds, tests, scans, pushes and signs¶
The merge request gates from post 03 check the source. None of them says whether the container starts. That's the image stage, and it runs only on main and release/*.
Read the green box top to bottom: that's the order of this post. Everything above "push" happens before the registry sees a byte.
The whole stage is one job with a one-line script:
# eshop-infra/ci/service-image.gitlab-ci.yml
service-image: # not `image:`, a GitLab keyword
extends: .eshop-infra
stage: image
tags: [eshop-shell]
timeout: 90m
resource_group: image-$CI_COMMIT_REF_SLUG
rules:
- if: $CI_PIPELINE_SOURCE =~ /^(push|web|api)$/
script:
- '"$INFRA/scripts/ci/gitlab-service-image.sh"'
artifacts:
when: always
expire_in: 30 days
paths: [reports/]
scripts/ci/gitlab-service-image.sh runs with set -euo pipefail and does this, in order:
- Log in to Harbor, if the registry variables reached the job.
docker buildeach image forlinux/amd64.- Start the temporary copy and wait until it's proven ready.
- Run the performance gate (Locust) against it.
- Run the DAST gate (OWASP ZAP) against it.
- Tear the copy down.
- Scan each image (Trivy) and write its SBOM.
- Push the tags that don't exist yet, sign, attest provenance, attach the SBOM twice.
Why one job and not five: the image never leaves the runner's Docker until it has passed everything. That's ADR 0007, "Release gates run in CI against a temporary copy; deploys are promotion PRs". Separate build, test, scan and push jobs would have to pass the image between runners, which means pushing an untested image somewhere.
The price is granularity: you can't retry DAST without rebuilding. For issue #3's change the job took 3 minutes 12 seconds of a 7-minute pipeline.
Pipeline #68, the merge of issue #3: deps and sast are green again on main, service-image is running, and the deploy trigger waits for it.
The registry login and the signing key are protected CI/CD variables, so only protected branches get them. Without them the job builds local/eshop/<service>, runs every gate and pushes nothing.
Run the image before you ship it¶
The temporary copy is the whole system in one Docker Compose project, scripts/gates/temporary-copy/compose.yaml, started and removed by scripts/gates/temporary-copy.sh.
Three short-lived containers join the copy's network in order: the readiness check, the load, the attacks. Harbor supplies only the services this pipeline didn't build.
| Part | Image | Note |
|---|---|---|
eshop-web, eshop-api, eshop-node-api, thirdparty-mock | parameters | the image under test, or that service's newest main build |
postgres | postgres:18.6-alpine3.23, by digest | data on tmpfs, gone on down |
gateway | caddy:2.11.7-alpine, by digest | routes like the cluster's Gateway, plain HTTP |
Three details are worth copying:
- The other services are their newest
mainbuilds.scripts/gates/latest-main-image.shpicks themain-<sha>-<ts>tag with the highest timestamp. So every merge must work with everyone else'smain, which is how ADR 0009 ("One repository per service; release candidates promote the images dev tested") enforces expand-then-contract across repositories. - The containers run hardened as in the cluster: read-only root file system, all Linux capabilities dropped.
- Each job gets its own copy. The Compose project is
eshop-temporary-copy-<job id>, so two jobs on one runner don't collide.
"Started" isn't "working", so temporary-copy/ready.mjs runs inside the network and proves it: health endpoints, seeded Products, a photo served, a Customer signing in by SMS code read from the mock, Staff signing in, an Auction with a Lot. From job #115:
--- temporary copy and gates
Network eshop-temporary-copy-115_default Created
...
Container eshop-temporary-copy-115-gateway-1 Healthy
ok gateway healthy (http://gateway:8080/gateway-healthz)
...
ok Customer signed in by SMS code through thirdparty-mock
ok Staff signed in
...
temporary copy ready
Only after temporary copy ready do the gates start.
The performance gate is a tripwire, not a capacity test¶
scripts/gates/perf.sh runs Locust 2.47.0 (pinned by digest) headless against http://gateway:8080. Load and limits live in one file:
# eshop-infra/scripts/gates/perf/locust.conf
users = 50
spawn-rate = 10
run-time = 60s
p95-ms = 500
max-error-ratio = 0.01
The gate fails when the p95 of all requests is over 500 ms, when more than 1% fail, or when no request was made at all. A JSON endpoint that answers 200 with a non-JSON body counts as failed. Job #115:
32 ms POST /api/auth/sms-code (254 requests, 0 failed)
24 ms GET / (web app) (50 requests, 0 failed)
17 ms POST /api/auth/sms-code/verify (254 requests, 0 failed)
6 ms GET /api/product-categories (755 requests, 0 failed)
...
Aggregated 6671 0(0.00%) | 3 0 54 2 | 111.91 0.00
6,671 requests in a minute, none failed, slowest p95 at 32 ms. The numbers describe a shared runner VM with PostgreSQL in memory, not production. The gate exists to catch the change that adds a query per row.
There's no accepted-findings file here. You make the code faster, or you change locust.conf in a reviewed merge request.
DAST only counts if the scanner actually got in¶
scripts/gates/dast.sh runs OWASP ZAP 2.17.0 four times, each from a fresh container:
| Scan | ZAP script | What it does |
|---|---|---|
web | zap-baseline.py | spiders the web app for one minute, passive rules only |
api | zap-api-scan.py | imports eshop-api's OpenAPI description, attacks every operation signed out |
customer | zap-api-scan.py | the same, signed in as a Customer |
staff | zap-api-scan.py | the same, signed in as Staff |
ZAP runs with -I, so its own warning levels don't decide the result.1 A separate verdict script, dast-verdict.py, reads the four JSON reports and fails the gate in two cases:
- any High alert that isn't accepted;
- a signed-in scan that got no 2xx answer from an endpoint only its role may use.
The second rule is the one most DAST setups miss. If sign-in silently breaks, every request is refused, ZAP finds nothing, and the scan looks clean. A hook writes each request and its status to <scan>-requests.tsv, and the verdict looks for successes on paths like /api/contracts (Customer) and /api/back-office (Staff).
Pitfall: a false positive accepted without an end date¶
ZAP's PII Disclosure rule flags any 16-digit number that passes the Luhn check as a card number. eshop-api puts a random hex traceId in every error body, and sometimes one matches.
It's the only accepted rule, and it carries a reason and an expiry:
# eshop-infra/scripts/gates/dast-rules.conf
# reason: false positive on random trace IDs; eShop has no card data to disclose (#105)
# until: 2027-05-20
10062 IGNORE (PII Disclosure)
A rule without # reason: and # until: makes the file malformed and the gate exits 2. The day after the date, the alert blocks again (ADR 0016, "Accepted findings expire").
Pitfall: the build machine's umask ends up inside the image¶
A Dockerfile COPY keeps the file modes of the checkout. On a hardened runner with umask 027, that builds an image holding files its own non-root user can't read, and the container dies at start with "permission denied".
No scanner reports that an image can't read its own files. Starting it does. The copy never becomes ready, the job fails, nothing is pushed.
The guard makes the image independent of the machine that builds it: COPY --chmod2 on every copy into a final stage:
# eshop-web/Dockerfile
FROM caddy:2.11.7-alpine@sha256:e70b164d...
# ...
COPY --chmod=u=rwX,go=rX Caddyfile /etc/caddy/Caddyfile
COPY --from=build --chmod=u=rwX,go=rX /app/dist /srv
USER 65532:65532
EXPOSE 8080
The temporary copy has the same trap in another form. It mounts ready.mjs from the checkout, and under a umask like 007 the container's user gets EACCES. So umask 022 in the runner's profile is a line in the rebuild guide.
One hole stays open. eshop-loadgen isn't part of the copy, so a loadgen image that can't start isn't caught here and reaches Harbor.
Scan the bytes you built, and write down what's in them¶
After the copy is gone, the job runs docker save on each image and gives the archive to scripts/gates/image-scan.sh: Trivy 0.76.1, pinned by digest. Scanning an archive instead of a registry address is what lets the scan run before the push.3
| Finding | Effect |
|---|---|
Any CRITICAL vulnerability or secret, fixable or not | fails the gate |
A forbidden licence not accepted (second pass, --scanners license) | fails the gate |
| Everything else | in the reports, never blocks |
This isn't a repeat of the dependency scan, which reads lock files. This one reads what ended up in the image, including the base image's OS packages.
Then scripts/gates/sbom.sh writes a CycloneDX SBOM from the same archive to reports/sbom/<service>.cdx.json. The SBOM's contents never fail the pipeline; failing to write one does, so no image is pushed without it.
Every gate leaves a folder under reports/, uploaded even when the job fails and kept 30 days. Start with each folder's summary.txt.
Push once, then sign the digest¶
Any failure in the top row means nothing is pushed. Note the one arrow that leaves the lab: the signature's entry in the public Rekor log.
A tag is never pushed twice¶
On main an image gets two tags, main-<sha> and main-<sha>-<ts> (the commit time in Unix seconds, which makes "newest" computable).
scripts/gates/tags-to-push.sh lists the repository's tags with crane ls and prints only the ones that don't exist. If any tag of an image exists, none is pushed. If the tags can't be listed, it exits 1: unknown isn't absent.
Docker builds aren't bit-for-bit repeatable, so a re-run could silently replace the image dev tested. With this rule a re-run passes every gate and then says "Every image of this commit is already pushed: nothing to push". The resource_group in the job closes the race between two runs.
Sign straight after the push, by digest, only what this run pushed¶
scripts/gates/sign-images.sh runs cosign 2.6.5 on each digest in pushed.txt:4
# eshop-infra/scripts/gates/sign-images.sh
if cosign sign --yes ${COSIGN_KEY:+--key "$COSIGN_KEY"} "$ref"; then
echo "signed $ref"
Job #115, lines 323 to 333: one digest pushed under two tags, cosign's notice that the record is public and permanent, the Rekor index, the signature pushed to Harbor, one image signed, the SBOM attached.
Three rules are built into the script:
- Only by digest. A tag can move, so a tag is never signed.
- Only what this run pushed. A re-run that pushed nothing signs nothing. Signing "whatever the tag names" would vouch for an image someone else may have pushed, which is the attack signing exists to stop.
- Straight after the push. Nothing else can fail in between.
Rule 2 has a hard consequence: if signing fails after a push, that image stays unsigned for good, and the fix is a new commit.
Why a key pair and not keyless¶
ADR 0011 is titled "Images are signed by the pipeline that pushed them, and the cluster runs only those (keyless at first; with eShop's key pair on the private GitLab)".
Keyless needs an identity provider that Sigstore's certificate authority (Fulcio) can reach. This GitLab sits on a private address that public Sigstore can't reach, and running a private Fulcio is out of proportion for a lab. So eShop signs with its own key pair:
| Half | Where it lives |
|---|---|
| Private key, password-encrypted | CI/CD variable COSIGN_PRIVATE_KEY (type File, protected), with COSIGN_PASSWORD (protected, masked) |
| Public key | eshop-infra/clusters/eshop-prd1/platform/cosign.pub |
What that trades away: the signature says "someone with the key signed this", not "this named pipeline on this named branch did". The ADR says a production GitLab that an identity provider can vouch for should sign keyless.
The Rekor caveat: signing is not private¶
sign-images.sh passes no --tlog-upload=false, so every signature uploads an entry to Sigstore's public Rekor transparency log.5 The log line tlog entry created with index: 3991732062 is that entry.
Per ADR 0011's note, an entry holds the signature, the public key and the hash of the signed payload: not the image, its name or the private key. It's kept on purpose, as a tamper-evident record anyone can check.
Two consequences you should decide on, not inherit:
- The runner needs internet access to
rekor.sigstore.devto sign, and the cluster's policy requires the entry. - Turning it off takes three changes made together:
--tlog-upload=falsewhen signing, noctlogin the policy,--insecure-ignore-tlogin sign-off'scosign verify. Change one and deploys or sign-off break.
Provenance and the SBOM ride on the same digest¶
A signature answers "did our key sign this?". It doesn't answer "which source, built by which pipeline, became this image?". scripts/gates/attest-images.sh attaches a SLSA v1 provenance statement with cosign attest --type slsaprovenance1 (ADR 0014, "Pushed images carry signed provenance, which the cluster checks: warn first").
Then the SBOM goes up twice: once with oras as an unsigned OCI referrer (ADR 0010), once as a signed attestation with cosign attest --type cyclonedx (ADR 0015, "Image SBOMs are also signed attestations of the digest"). The unsigned one stays for tools that don't know cosign. The signed one is what sign-off verifies and publishes, so someone with registry write access can't swap the list unnoticed.
An eshop-api build, job 440, which pushes two images:
signed <HARBOR>/eshop/eshop-api@sha256:70cff77f5639...
signed <HARBOR>/eshop/eshop-sync-master@sha256:4b1db33bd076...
sign-images: signed 2 image(s)
attested <HARBOR>/eshop/eshop-api@sha256:70cff77f5639...
attested <HARBOR>/eshop/eshop-sync-master@sha256:4b1db33bd076...
attest-images: provenance attached to 2 image(s)
<HARBOR>/eshop/eshop-api:main-d61a401 (sha256:70cff77f5639...): SBOM attached
<HARBOR>/eshop/eshop-api@sha256:70cff77f5639...: signed SBOM attached
And the statement itself, read back from Harbor for an eshop-loadgen image (trimmed):
{
"predicateType": "https://slsa.dev/provenance/v1",
"subject": [{ "name": "<HARBOR>/eshop/eshop-loadgen", "digest": { "sha256": "ef30c9a1bcfc68ed..." } }],
"predicate": {
"buildDefinition": {
"buildType": "https://<GITLAB>/root/eshop-infra/-/blob/main/ci/service-image.gitlab-ci.yml",
"externalParameters": {
"commit": "2590f5380e67532bdd8f295eedb4eff6aecd50b8",
"project": "root/eshop-loadgen", "protected": "true", "ref": "main", "source": "push"
},
"internalParameters": {
"gates": { "commit": "a48bf610b38f...", "project": "root/eshop-infra", "ref": "main" }
}
},
"runDetails": {
"builder": { "id": "https://<GITLAB>/-/runners/2", "version": { "gitlab-runner": "19.5.3" } }
}
}
}
Neither attestation goes to Rekor. Both are signed with --tlog-upload=false, because Rekor would publish the statement itself: project paths, the GitLab address, commits, every package in the image. They're verified with the public key alone:
cosign verify-attestation --key clusters/eshop-prd1/platform/cosign.pub --type slsaprovenance1 \
--insecure-ignore-tlog=true <HARBOR>/eshop/eshop-loadgen@sha256:<digest> \
| jq -r .payload | base64 -d | jq .
What it looks like in Harbor¶
Project eshop on Harbor 2.15: six repositories, public so the cluster pulls without a pull secret. Pushing takes a robot account scoped to this project.
Issue #3's image, expanded: signature.cosign is the signature, subject.accessory is the SBOM. The second row is one image with three names (0.10.0, 0.10.0-rc.1 and its main- tag), so the release carries the signature it got on main.
Three project settings matter (ADR 0012, "eShop's images live in the lab Harbor, named by IP and trusted through its CA"):
- Tag immutability on
*.*.*, so release and candidate tags can't move. - Retention keeps
sha256-*tags. That's where cosign's classic format stores signatures and attestations. Delete them and signed images become unsigned. - Harbor's own scanning is off. The "Not Scanned" column is expected: the Trivy gate in CI is the scan.
Pitfall: two first pipelines race on an empty tool cache¶
A brand-new runner has an empty tool cache, and the first jobs fill it. Two first pipelines at once collide: one deletes the other's cosign download from the shared cache. The job installs cosign just before the push, so it fails after building and testing but before pushing anything.
A retry passes. The guard is a rule in the rebuild guide: run the first pipeline on a new runner alone.
The cluster refuses what the key didn't sign¶
Signing is a habit until something checks it. Whoever holds a push credential can put anything under a name the cluster trusts.
eShop's check is Sigstore's policy-controller6 (Helm chart 0.10.8, policy-controller v0.13.1, namespace cosign-system) with one ClusterImagePolicy:
# eshop-infra/clusters/eshop-prd1/platform/image-policy.yaml
apiVersion: policy.sigstore.dev/v1beta1
kind: ClusterImagePolicy
metadata:
name: eshop-images
spec:
mode: enforce
images:
- glob: "<HARBOR>/eshop/**"
# ... and two Docker Hub globs
authorities:
- name: eshop-key
key:
secretRef:
name: eshop-cosign-public-key
ctlog:
url: https://rekor.sigstore.dev
Three questions per pod: is the namespace labelled, does the image match a glob, is there a valid signature by eShop's key. Note the grey box top right: if the webhook is down, pods are admitted unchecked.
The settings that decide what's covered:
| Setting | Value | Effect |
|---|---|---|
Namespace label policy.sigstore.dev/include: "true" | eshop-dev, eshop-qa, eshop-prod, thirdparty | only labelled namespaces are checked |
no-match-policy | allow | PostgreSQL, SQL Server, Samba match no glob and are admitted |
webhook.failurePolicy | Ignore | webhook down means admitted unchecked |
webhook.registryCaBundle | ConfigMap harbor-ca | the webhook trusts Harbor's private CA, never "insecure" |
The fastest proof the check is alive is a server-side dry run with a digest that doesn't exist. It goes through admission and stores nothing:
kubectl -n eshop-dev run unsigned \
--image=<HARBOR>/eshop/eshop-web@sha256:0000000000000000000000000000000000000000000000000000000000000000 \
--dry-run=server
In enforce mode it's refused with a message that names the policy eshop-images. A cluster admin runs it after every change to the policy, the key or the controller.
In a real deploy the refusal shows up indirectly: the Deployment is accepted, its ReplicaSet can't create pods, Flux's health check never turns Ready, and the deploy job ends with "Flux could not apply it". The fix is never on the cluster. It's a new commit, which builds, pushes and signs a new image.
Warn first, enforce when everything running passes¶
Introduce an admission policy in mode: warn, and flip it to enforce once every running image satisfies it. Enforce earlier and the cluster refuses its own pods at their next rollout or restart, because an image built before the requirement existed can't meet it.
Both eShop policies are in enforce. The second is a ClusterImagePolicy of its own, platform/provenance-policy.yaml, that asks each eShop image for an attestation naming an eShop project and a protected ref:
# eshop-infra/clusters/eshop-prd1/platform/provenance-policy.yaml
apiVersion: policy.sigstore.dev/v1beta1
kind: ClusterImagePolicy
metadata:
name: eshop-provenance
spec:
mode: enforce
images:
- glob: "<HARBOR>/eshop/**"
authorities:
- name: eshop-key
key:
secretRef:
name: eshop-cosign-public-key
attestations:
- name: built-by-an-eshop-pipeline
predicateType: https://slsa.dev/provenance/v1
policy:
type: cue
data: |
predicateType: "https://slsa.dev/provenance/v1"
predicate: buildDefinition: externalParameters: {
project: =~"^root/(eshop-api|eshop-web|eshop-node-api|thirdparty-mock|eshop-loadgen)$"
protected: "true"
}
Two policies instead of one, so each has its own mode. Every matching policy must pass, so the second can only add to the first.
Test a policy with the same server-side dry run, against real digests. In warn, an image without provenance is admitted and the reason is printed; an attested one passes silently:
$ kubectl -n eshop-prod run probe-old --image=<HARBOR>/eshop/eshop-web@sha256:0cf4d684... --dry-run=server
Warning: failed policy: eshop-provenance: spec.containers[0].image
Warning: <HARBOR>/eshop/eshop-web@sha256:0cf4d684... attestation key validation failed for authority eshop-key ...: no matching attestations:
pod/probe-old created (server dry run)
$ kubectl -n thirdparty run probe-new --image=<HARBOR>/eshop/eshop-loadgen@sha256:ef30c9a1... --dry-run=server
pod/probe-new created (server dry run)
Write the flip condition in the policy file's header. eShop's header says enforce holds because every environment runs attested images, each checked with cosign verify-attestation. In enforce, a pod whose eShop image has no such statement is refused at its next rollout or restart, and what already runs keeps running.
Pitfall: the webhook's rewrite puts an operator in a restart loop¶
When policy-controller admits a pod, it resolves each image tag at the registry and rewrites the reference to tag plus digest, so what was checked is what runs. That's a mutation, and operators notice mutations.
CloudNativePG compares the image in its Cluster resource with the image of the running pod, sees a difference it didn't ask for, and replaces the pod. The new pod is rewritten again, without end.
The guard: leave the webhook nothing to rewrite. Pin by digest.
# the CloudNativePG Cluster manifest
imageName: ghcr.io/cloudnative-pg/postgresql:18.6-system-trixie@sha256:48a0...
The operator is installed with its image tag set to 1.30.1@sha256:923c... as well. The cost is a digest in two places on every upgrade, and a bare tag in either one brings the loop back.
Key rotation: documented, not rehearsed¶
One key pair signs images, provenance, SBOMs and deploy manifests. ADR 0011's answer to a long-lived key is a written rotation, yearly and at once on a suspected leak, in clusters/eshop-prd1/README.md:
- Make a new key pair; commit its public half as
platform/cosign-next.pub. - Cluster admin runs
bootstrap.sh: each policy gets a second authority, so both keys are trusted. - Replace
COSIGN_PRIVATE_KEYandCOSIGN_PASSWORDin GitLab. - Rebuild every service on
mainand release, so QA and prod run images signed by the new key. - Run
scripts/check-signatures.sh --key clusters/eshop-prd1/platform/cosign-next.pub. Exit 1 means an image would be refused: go back one step. - In one merge request, move
cosign-next.pubovercosign.pub;bootstrap.shagain. - Destroy the old private key.
On a leak the order changes: new key, new variables, then drop the old key at once. Every step is a person's. The procedure is documented and not rehearsed.
Threat, control, and where it's enforced¶
| Threat | Control | Where it is enforced |
|---|---|---|
| An image that builds but can't start, or breaks the service next to it | temporary copy + ready.mjs | service-image job, before the push |
| A regression in latency or errors under load | Locust, p95 over 500 ms or over 1% errors | scripts/gates/perf.sh, before the push |
| A High-risk web or API flaw, or a scan that never signed in | ZAP, four scans, role-only 2xx check | scripts/gates/dast.sh, before the push |
| A critical CVE, a secret or a forbidden licence inside the image | Trivy on the docker save archive | scripts/gates/image-scan.sh, before the push |
| "Which images contain this library?" next month | CycloneDX SBOM on the digest, unsigned and signed | sbom.sh, attach-sbom.sh, attest-sbom.sh; sign-off refuses an image without one |
| A tag silently replaced by a re-run | never push an existing tag | tags-to-push.sh; Harbor immutability for *.*.* only |
| An image pushed with a stolen registry credential | cosign signature by digest | policy-controller, eshop-images, enforce |
| An image signed with the key but not built by the pipeline | signed SLSA provenance | policy-controller, eshop-provenance, enforce |
| A malicious merge request | protected variables: no login, no key | GitLab protected branches |
| A stolen signing key | two-key rotation, leak procedure | a person, with check-signatures.sh |
| An accepted risk nobody remembers | expiry date, at most a year ahead | scripts/gates/accepted.py, in every gate |
The signature proves eShop's pipeline pushed this digest. That it passed the gates follows only from the script's order: signing comes after them.
Where this lands on SLSA, and what's not done¶
| SLSA Build level7 | Asks for | eShop |
|---|---|---|
| 1 | provenance exists | Met: every image the pipeline pushes carries one |
| 2 | a hosted build platform generates and signs it | Partly: a dedicated runner and signed provenance, but the job writes its own statement and reads the key |
| 3 | the build can't forge its provenance; builds are isolated | Not met: one shell runner, a shared cache, the key is a CI variable |
Level 3 here would need keyless signing with GitLab's identity tokens and a reachable Fulcio, plus isolated, single-use build machines.
What I'd change for production, straight from the caveats:
- Fail closed.
failurePolicy: Failonce the webhook runs several replicas with a disruption budget. With fail-open, an outage is silent, so alert on the webhook's availability. - Move the key into a KMS that signs on request and never releases it, so "can run a job on
main" stops meaning "holds the key". Rehearse the rotation. - Decide about Rekor on purpose: public, private, or off with the three changes together.
- Cover third-party images. PostgreSQL, SQL Server and Samba are pinned by digest, which fixes what runs but doesn't prove who built it.
- Add a second DAST layer against deployed QA through the real Gateway with TLS. The gate scans plain HTTP behind a Caddy stand-in.
Also not covered: the sync master and SQL Server aren't in the temporary copy, so a broken Enterprise sync passes every gate here. And the signing key and registry login live in the same GitLab, so the signature defends against a leaked registry login, not a compromised GitLab.
Summary¶
- One job builds, tests, scans, pushes and signs, so an image that failed a gate never reaches the registry.
- Run the image beside the other services' newest
mainbuilds and prove readiness with real sign-ins before any gate. - Performance: fixed load, p95 and error-ratio thresholds in one reviewed file, no accept list.
- DAST: scan signed in, and fail when a signed-in scan gets no 2xx on a role-only path.
- Every accepted finding has a reason and an expiry date.
- Set file modes with
COPY --chmod, not the build machine's umask. - Scan the
docker savearchive before the push; no SBOM, no push. - Never push an existing tag.
- Sign by digest, only what this run pushed. A failed signature means a new commit.
- Decide what goes to a public transparency log; keep attestations out of it.
- Admission policy: start in
warn, flip toenforcewhen everything running passes, write the flip condition in the file. - Pin by digest any image an operator reconciles.
- Rehearse the key rotation, don't only write it.
Next: Post 05: Delivery and releases: how a signed digest moves from dev to QA to production without ever being rebuilt, and who has to say yes.
-
ZAP, API Scan —
zap-api-scan.pyoptions, including-c(config file to INFO, IGNORE or FAIL warnings) and-I(do not return failure on warning). ↩ -
Docker, Dockerfile reference —
COPY --chmodsupports octal and symbolic notation. ↩ -
Trivy, Container Image — scanning image tar files with
--input, and SBOM generation for images. ↩ -
Sigstore, Signing Containers —
cosign sign --key cosign.key $IMAGEwith a local key pair. ↩ -
Sigstore, Rekor overview — "a restful API-based server for validation, and a transparency log for storage". ↩
-
Sigstore, Policy Controller overview —
ClusterImagePolicy, the opt-in namespace labelpolicy.sigstore.dev/include: "true", and tag resolution at admission. ↩ -
SLSA, Security levels, v1.0 — Build L1 "Provenance exists", L2 "Hosted build platform", L3 "Hardened builds". ↩
Discussion
Have thoughts on this post? Share them below — questions, corrections, or your own experience are all welcome.








