Cosign — open-source tool (Sigstore project) for cryptographic signing of container images. Supply chain security essential in 2026. Keyless mode — uses OIDC (GitHub Actions / Google / Microsoft) instead of long-lived keys. Verify: cosign verify --certificate-identity=... image. SLSA (Supply-chain Levels for Software Artifacts) level 3 compliance achievable with cosign + GitHub Actions.
Below: step-by-step, working examples, common pitfalls, FAQ.
brew install cosign or download the binarycosign sign --yes ghcr.io/me/app:v1cosign verify image --certificate-identity=user@example.com| Scenario | Config |
|---|---|
| GitHub Actions keyless sign | # .github/workflows/release.yml
permissions:
id-token: write # OIDC for cosign
packages: write
- name: Sign image
run: |
cosign sign --yes \
ghcr.io/${{ github.repository }}:${{ github.sha }} |
| Verify signed image | cosign verify \
--certificate-identity-regexp='.+@example.com' \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
ghcr.io/me/app:v1 |
| Kubernetes policy-controller | apiVersion: policy.sigstore.dev/v1beta1
kind: ClusterImagePolicy
metadata:
name: enforce-signed
spec:
images: [ { glob: 'ghcr.io/me/*' } ]
authorities:
- keyless:
identities:
- issuer: https://token.actions.githubusercontent.com
subjectRegExp: '.+' |
| Key-based (legacy) | # Generate key pair
$ cosign generate-key-pair
# Sign with private key
$ cosign sign --key cosign.key ghcr.io/me/app:v1
# Verify with public
$ cosign verify --key cosign.pub ghcr.io/me/app:v1 |
| SBOM attach + sign | # Generate SBOM
$ syft ghcr.io/me/app:v1 -o spdx-json > sbom.json
# Attach + sign atomically
$ cosign attest --predicate sbom.json --type spdx \
ghcr.io/me/app:v1 |
The tool checks HTTP security headers, SSL/TLS configuration, server info leaks, and protection against common attacks (XSS, clickjacking, MIME sniffing). A grade fromA to F shows overall security level.
Checking Content-Security-Policy, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and more.
TLS version, certificate expiry, chain of trust, HSTS support.
Finding exposed server versions, debug modes, open configs, and directories.
Detailed report explaining each issue with specific steps to fix it.
HTTP header audit
config verification
CSP & HSTS setup
compliance checks
Strict-Transport-Security.Server: Apache/2.4.52 helps attackers find exploits. Hide the version.DENY or SAMEORIGIN.nosniff, browsers may misinterpret file types (MIME sniffing).Content-Security-Policy-Report-Only, monitor violations, then enforce.Server, X-Powered-By, X-AspNet-Version from responses.Security check history and HTTP security header monitoring.
Sign up freeSupply chain attacks (SolarWinds, xz) showed: untrusted images = RCE. Signing proves "this image was built by X CI". SLSA level 3 requires it.
Keyless: no key management, OIDC-based, fits most. Key-based: offline signing, for air-gapped, requires key storage (HSM / KMS).
Software Bill of Materials. syft / Trivy generate list of packages in image. Combined with cosign attest — creates attested SBOM.
sigstore-policy-controller (preferred 2025+) or Kyverno with cosign verify. Block unsigned images or wrong signer.