sign-and-attest composite (Step C-1 of pin-reduction)#13
Merged
Conversation
Encapsulates the four-step attestation pipeline that ships in every
SC release workflow today (push.yaml, branch-preview.yaml,
build-staging.yml):
1. Generate CycloneDX SBOM (syft scan on the image's registry layout).
2. Sign with cosign keyless (Fulcio + Rekor).
3. Attest the SBOM via `cosign attest --type cyclonedx`.
4. Publish SLSA Build L3 provenance via `actions/attest-build-provenance@v4`
(subject-name + subject-digest), deliberately NOT pushing the
attestation to the registry — that would silently overwrite the
`cosign attest cyclonedx` slot under the `.att` tag. Provenance
stays in the GH attestation API; SBOM stays in the registry. This
cross-attestation contract is documented in SC's SECURITY.md.
Per-step outcomes are surfaced as outputs (`sbom-outcome`,
`sign-outcome`, `attest-outcome`, `slsa-outcome`) so the calling
workflow can aggregate into a single ::warning:: summary the same way
push.yaml does today. `soft-fail: true` (default during Phase 2 bake-
in) makes each step `continue-on-error`; consumers flip to `false`
after 14 days of clean post-publish verification.
Caller responsibilities (documented in the composite description):
- Set `permissions: id-token: write` + `attestations: write` on the
calling job (OIDC for cosign keyless + the GitHub attestation API).
- Pass `image-ref` WITH digest (`@sha256:…`). Verification by tag is
unsafe (TOCTOU) and the composite rejects nothing — the caller must
ensure digest-pinning at the upstream `docker/build-push-action`
step.
- Set `install-tools: false` if the calling job has already invoked
`install-attest-tools` (idempotent, but saves ~10s).
## Step C in context
This is **Step C-1** of the consolidation plan tracked in HARDENING.md
"Consumer-side pin reduction":
- Step A (PR #12, open): setup-sc-tooling composite
- Step B (PR #12, open): install-attest-tools composite (promoted
from api-local)
- **Step C-1 (this PR)**: sign-and-attest composite — encapsulates
the inner signing/attestation flow that consumer build workflows
repeat per-image.
- Step C-2 (next session): `sc-image-release.yml` reusable workflow
that wraps `setup-sc-tooling` + `docker/build-push-action` +
`sign-and-attest` + `notify-telegram` into a one-call build-and-
publish-one-image flow. Driven by a matrix on the consumer side.
## Tests
`.github/workflows/self-test-sign-and-attest.yml` is a real
end-to-end integration test, not a static check:
1. Build a tiny alpine-based test image (Dockerfile generated inline).
2. Push to ghcr.io/${{ github.repository }}/sign-and-attest-test
under a unique `run-<id>-attempt-<n>` tag.
3. Invoke the composite against the freshly-pushed digest.
4. Run the three verification commands a real consumer would run:
- `cosign verify`
- `cosign verify-attestation --type cyclonedx`
- `gh attestation verify --repo simple-container-com/actions`
against the identity-regex `^https://github\.com/simple-container-com/actions/`.
5. Assert all four composite outputs (`sbom-outcome` /
`sign-outcome` / `attest-outcome` / `slsa-outcome`) are
`success`, and that the SBOM file is on disk.
The test uses `soft-fail: false` so a transient sigstore-public outage
surfaces as a clear CI failure instead of being swallowed. Wall-clock
~2 min per run.
## Coverage
- actionlint clean
- shellcheck clean
- `bash semgrep-scan/run-tests.sh` — 0 findings full-repo
Signed-off-by: Dmitrii Creed <creeed22@gmail.com>
Security Scan ResultsRepository:
Scanned at 2026-05-16 21:03 UTC |
Semgrep Scan ResultsRepository:
Scanned at 2026-05-16 21:03 UTC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A composite action that encapsulates the four-step attestation pipeline that ships in every SC release workflow today (
push.yaml,branch-preview.yaml,build-staging.yml):syft scan registry:<image-ref>--type cyclonedx, registry slot)actions/attest-build-provenance@v4(GitHub attestation API slot, deliberately NOT registry — see SC SECURITY.md for the cross-attestation contract)Per-step outcomes (
sbom-outcome,sign-outcome,attest-outcome,slsa-outcome) are surfaced as outputs so the consumer can aggregate them into a single::warning::summary the same waypush.yamldoes today.Step C in context
setup-sc-toolingcompositeinstall-attest-toolscomposite (promoted from api-local)sign-and-attestcomposite (this PR)sc-image-release.ymlreusable workflow that wraps setup +docker/build-push-action+sign-and-attest+notify-telegraminto a single-call build-and-publish flowTests — real integration
.github/workflows/self-test-sign-and-attest.ymlis not a static check. It:ghcr.io/simple-container-com/actions/sign-and-attest-test:run-<id>-attempt-<n>cosign verifycosign verify-attestation --type cyclonedxgh attestation verify --repo simple-container-com/actions…all against the identity regex
^https://github\.com/simple-container-com/actions/.successand the SBOM file exists on diskUses
soft-fail: falseso a transient sigstore-public outage surfaces as clear CI failure. Wall-clock ~2 min per run.Caller responsibilities (documented in the composite description)
permissions:on the calling job:image-refWITH digest (@sha256:…). Tag-only references are TOCTOU-unsafe.install-tools: falseif the calling job already invokedinstall-attest-tools(idempotent, but saves ~10s).Verification
bash semgrep-scan/run-tests.sh— 0 findings full-repoFollow-up after merge
push.yaml/branch-preview.yaml/build-staging.ymlto usesign-and-attest@<sha>instead of the inline 5-step block per image. Replaces ~50 LOC per image with ~7.sc-image-release.yml) tracked in HARDENING.md for the next session.