cosign
БесплатноБез исполняемых скриптовНе проверенSign, verify and attest container images and other OCI artifacts with Cosign, the Sigstore tool. Use when a user asks to sign an image in CI, verify a…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Cosign — Container Image Signing and Verification
Overview
Cosign signs OCI images and stores the signature in the registry next to them. In Cosign 3.x (3.1.4 when checked) signatures and attestations use the Sigstore bundle format and are stored as OCI referrers, and the default signing config sends keyless signatures to the public Rekor transparency log. Two modes exist: a key pair you manage, or keyless signing with a short-lived certificate bound to an OIDC identity (GitHub Actions, Google).
Instructions
Install
brew install cosign
On Linux download the binary and check it against the published checksums before use:
V=v3.1.4
curl -sLO https://github.com/sigstore/cosign/releases/download/$V/cosign-linux-amd64
curl -sLO https://github.com/sigstore/cosign/releases/download/$V/cosign_checksums.txt
grep ' cosign-linux-amd64$' cosign_checksums.txt | sha256sum -c -
install -m 0755 cosign-linux-amd64 ~/.local/bin/cosign
Sign and verify with a key pair
cosign generate-key-pair # asks for a password; writes cosign.key and cosign.pub
docker push ghcr.io/dataplane-io/orders-api:v1.2.3
DIGEST=sha256:c64c687cbea9300178b30c95835354e34c4e4febc4badfe27102879de0483b5e # the digest `docker push` prints
cosign sign --key cosign.key --yes ghcr.io/dataplane-io/orders-api@$DIGEST
cosign verify --key cosign.pub ghcr.io/dataplane-io/orders-api@$DIGEST
Sign the digest, not the tag: a tag can move, a digest cannot. A key-based cosign sign also uploads an entry to the public Rekor log by default, which reveals the image name. Store cosign.key only in a secret manager and pass its password through COSIGN_PASSWORD. For tests against a private registry, --use-signing-config=false --tlog-upload=false signs without Rekor (cosign 3.1.4 prints deprecation warnings for both flags but still honors them), and cosign verify --insecure-ignore-tlog checks it; never use these for production images.
Keyless signing and verification
cosign sign --yes ghcr.io/dataplane-io/orders-api@$DIGEST # opens a browser for OIDC login on a workstation
cosign verify \
[email protected] \
--certificate-oidc-issuer=https://accounts.google.com \
ghcr.io/dataplane-io/orders-api@$DIGEST
cosign verify for keyless images always needs an identity (--certificate-identity or --certificate-identity-regexp) and an issuer (--certificate-oidc-issuer or the regexp form). The COSIGN_EXPERIMENTAL=1 variable seen in old guides does nothing any more; drop it.
CI: sign in GitHub Actions
# .github/workflows/build.yml
on:
push:
branches: [main]
jobs:
build-and-sign:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # lets the job get an OIDC token for keyless signing
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build
uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
- uses: sigstore/cosign-installer@v4
- name: Sign by digest (keyless)
run: cosign sign --yes ghcr.io/${{ github.repository }}@${{ steps.build.outputs.digest }}
Verify what this workflow produced by pinning the workflow identity:
cosign verify \
--certificate-identity=https://github.com/dataplane-io/orders-api/.github/workflows/build.yml@refs/heads/main \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
ghcr.io/dataplane-io/orders-api@sha256:c64c687cbea9300178b30c95835354e34c4e4febc4badfe27102879de0483b5e
Attestations (SBOM, provenance)
--type accepts slsaprovenance, slsaprovenance02, slsaprovenance1, link, spdx, spdxjson, cyclonedx, vuln, openvex, custom, or a URI.
syft ghcr.io/dataplane-io/orders-api@$DIGEST -o spdx-json > sbom.spdx.json
cosign attest --yes --predicate sbom.spdx.json --type spdxjson ghcr.io/dataplane-io/orders-api@$DIGEST
cosign verify-attestation --type spdxjson \
--certificate-identity-regexp='^https://github.com/dataplane-io/orders-api/' \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
ghcr.io/dataplane-io/orders-api@$DIGEST | jq -r .payload | base64 -d | jq .predicateType
In a workflow, install syft first with uses: anchore/sbom-action/download-syft@v0. cosign tree <image> lists the signatures and attestations attached to an image.
Verify in Kubernetes (Kyverno)
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-image-signatures
spec:
background: false
rules:
- name: verify-cosign-signature
match:
any:
- resources:
kinds: ["Pod"]
verifyImages:
- f
Установить cosign в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cosign?
Sign, verify and attest container images and other OCI artifacts with Cosign, the Sigstore tool. Use when a user asks to sign an image in CI, verify a signature before deploying, do keyless signing with GitHub OIDC, attach an SBOM or provenance attestation, or enforce signed images in Kubernetes with Kyverno.
Как установить скилл cosign?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cosign запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub