verifying-build-provenance-with-slsa-sigstore
它能做什么
使用 cosign 和 slsa-verifier 这两个工具,验证一个程序或文件是否由预期的来源安全地构建而成。这有助于确保软件没有被恶意人员篡改。
适用场景
- ✓在安装或使用从互联网下载的程序之前。
- ✓在使用他人开发的软件组件时。
- ✓当你想确保自己的软件构建过程安全时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/verifying-build-provenance-with-slsa-sigstore/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请验证程序“my_app”是由代码仓库“my_github/my_project”在版本“v1.0”下构建的。”
每周 5 个新技能,1 分钟读完。
工作原理
cosign 和 slsa-verifier 会检查数字签名和来源信息(溯源记录)。它们会连接可信的服务,确认声称构建该文件的人确实构建了它,并且文件来自正确的地方。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Verifying Build Provenance with SLSA and Sigstore
Overview
Build-provenance verification answers a question that defeats many supply-chain attacks: was this artifact actually built from the source I think it was, by the builder I trust, without tampering? Attackers who compromise a build system, swap a compiled release, or inject a malicious step (as in the SolarWinds and 3CX incidents) produce artifacts that look legitimate but lack verifiable provenance. SLSA (Supply-chain Levels for Software Artifacts, https://slsa.dev) defines Build levels (L1–L3) describing increasing provenance integrity, and Sigstore (https://www.sigstore.dev) provides the signing and transparency infrastructure: cosign for signing/verifying artifacts and attestations, Fulcio for short-lived keyless certificates bound to an OIDC identity, and Rekor as a tamper-evident transparency log.
This skill covers verifying signatures and SLSA provenance with cosign (cosign verify, cosign verify-attestation, cosign verify-blob-attestation) and slsa-verifier (slsa-verifier verify-artifact), enforcing the builder identity (the GitHub Actions workflow that produced the artifact) and the expected source repository. Keyless verification ties trust to an OIDC issuer (e.g., https://token.actions.githubusercontent.com) and a certificate identity rather than a long-lived private key.
This maps to MITRE ATT&CK T1195 — Supply Chain Compromise (provenance verification detects/blocks tampered artifacts) and NIST CSF PR.DS-01 (the confidentiality, integrity, and availability of data-at-rest are protected; CSF 2.0 absorbed the retired 1.1 PR.DS-06 integrity-checking outcome here).
When to Use
- In CI/CD before deploying or promoting any container image or release binary.
- When consuming third-party artifacts (base images, Go/npm releases) that publish attestations.
- When establishing a SLSA Build L3 producer pipeline and enforcing it at the consumer side.
- During incident response to confirm whether a deployed artifact's provenance is intact.
- In admission control (e.g., Kubernetes via policy-controller / Kyverno) to admit only verified images.
Prerequisites
- cosign (Sigstore CLI):
go install github.com/sigstore/cosign/v2/cmd/cosign@latest # or download a release binary from https://github.com/sigstore/cosign/releases - slsa-verifier:
go install github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier@latest # or: curl -sSL https://github.com/slsa-framework/slsa-verifier/releases/latest/download/slsa-verifier-linux-amd64 \ -o /usr/local/bin/slsa-verifier && chmod +x /usr/local/bin/slsa-verifier - Network access to Rekor (
https://rekor.sigstore.dev) and Fulcio for transparency-log verification. - The artifact plus its provenance/attestation bundle (
.sigstore,.intoto.jsonl, or attached OCI attestation).
Objectives
- Verify a keyless cosign signature on a container image, pinning OIDC issuer and certificate identity.
- Verify a SLSA provenance attestation on an image with
cosign verify-attestation --type slsaprovenance. - Verify a release binary's provenance with
slsa-verifier verify-artifact, pinning source repo and tag. - Verify GitHub artifact attestations / blob bundles with
cosign verify-blob-attestation. - Gate CI and admission control on successful verification; understand SLSA Build L1–L3.
MITRE ATT&CK Mapping
| ID | Tactic | Technique Name | Relevance |
|---|---|---|---|
| T1195 | Initial Access | Supply Chain Compromise | Verifying provenance and signatures detects artifacts that were tampered with or substituted in the build/distribution chain, preventing supply-chain compromise from reaching deployment. |
Workflow
Step 1: Verify a keyless cosign signature on an image
Pin both the OIDC issuer and the certificate identity (the exact workflow that signed). A bare cosign verify without identity pinning is meaningless — anyone can sign.
cosign verify \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
--certificate-identity-regexp "^https://github.com/myorg/myrepo/.github/workflows/.*@refs/tags/v.*" \
ghcr.io/myorg/myrepo:v1.2.3
A non-zero exit or empty result means verification failed — do not deploy.
Step 2: Verify the SLSA provenance attestation on the image
…
常见问题
什么是“溯源”(provenance)?
溯源就像一段历史记录,显示一个文件由谁创建、何时创建,以及如何创建。它能证明文件是真实可信的。
cosign 和 slsa-verifier 是什么?
它们是命令行工具,用于验证软件文件的溯源和签名。它们借助 Sigstore 等技术来保障安全。
为什么要验证溯源?
为了防范供应链攻击,也就是攻击者用恶意版本替换合法软件的情况。验证溯源能确保你使用的是正确且可信的软件。
详情
作者的原始描述
Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI/CD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during
热度
- GitHub 星标
- 35k
- 排名
- #8408
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。