cosign

为 Cosign 提供专家级指导。Cosign 是 Sigstore 的工具,用于对容器镜像和其他 OCI 制品进行签名、验证及附加元数据。适用于在 CI/CD 流程中签名镜像、部署前验证签名,并将 SBOM 与漏洞扫描结果作为证明附加到制品以实施供应链安全。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "cosign":https://skillpi.com/zh/skills/deepskill-deb259713e75d6de51453cc50c15778414190e39af78d4021e122e7071cfc23c。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为 Cosign 提供专家级指导。Cosign 是 Sigstore 的工具,用于对容器镜像和其他 OCI 制品进行签名、验证及附加元数据。适用于在 CI/CD 流程中签名镜像、部署前验证签名,并将 SBOM 与漏洞扫描结果作为证明附加到制品以实施供应链安全。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: cosign
description: Expert guidance for Cosign, the Sigstore tool for signing, verifying, and attaching metadata to container images and other OCI artifacts. Helps developers implement supply chain security by signing images in CI/CD, verifying signatures before deployment, and attaching SBOMs and vulnerability scan results as attestations.
license: Apache-2.0
compatibility: No special requirements
metadata:
  author: terminal-skills
  version: 1.0.0
  category: devops
  tags:
  - container-signing
  - supply-chain
  - sigstore
  - verification
  - sbom

Cosign — Container Image Signing and Verification

Overview

Cosign, the Sigstore tool for signing, verifying, and attaching metadata to container images and other OCI artifacts. Helps developers implement supply chain security by signing images in CI/CD, verifying signatures before deployment, and attaching SBOMs and vulnerability scan results as attestations.

Instructions

Sign and Verify Images

# Install
brew install cosign

# Generate a keypair
cosign generate-key-pair
# Creates cosign.key (private) and cosign.pub (public)

# Sign an image after building
docker build -t myregistry.com/myapp:v1.2.3 .
docker push myregistry.com/myapp:v1.2.3
cosign sign --key cosign.key myregistry.com/myapp:v1.2.3

# Verify before deploying
cosign verify --key cosign.pub myregistry.com/myapp:v1.2.3

# Keyless signing with Sigstore (no key management!)
# Uses OIDC identity (GitHub Actions, Google, etc.)
cosign sign myregistry.com/myapp:v1.2.3
# Opens browser for OIDC login, signs with ephemeral key,
# records signature in Rekor transparency log

# Keyless verification
cosign verify \
  --certificate-identity=user@example.com \
  --certificate-oidc-issuer=https://accounts.google.com \
  myregistry.com/myapp:v1.2.3

CI/CD Integration

# .github/workflows/build.yml — Sign images in CI
jobs:
  build-and-sign:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write                   # Required for keyless signing
      packages: write
    steps:
      - uses: actions/checkout@v4

      - name: Build and push
        run: |
          docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .
          docker push ghcr.io/${{ github.repository }}:${{ github.sha }}

      - name: Install Cosign
        uses: sigstore/cosign-installer@v3

      - name: Sign image (keyless)
        run: |
          cosign sign \
            --yes \
            ghcr.io/${{ github.repository }}:${{ github.sha }}
        env:
          COSIGN_EXPERIMENTAL: 1

      - name: Attach SBOM
        run: |
          # Generate SBOM with syft
          syft ghcr.io/${{ github.repository }}:${{ github.sha }} -o spdx-json > sbom.spdx.json

          # Attach SBOM as an attestation
          cosign attest \
            --yes \
            --predicate sbom.spdx.json \
            --type spdxjson \
            ghcr.io/${{ github.repository }}:${{ github.sha }}

      - name: Attach vulnerability scan
        run: |
          # Scan with grype
          grype ghcr.io/${{ github.repository }}:${{ github.sha }} -o json > vuln-scan.json

          # Attach scan results
          cosign attest \
            --yes \
            --predicate vuln-scan.json \
            --type vuln \
            ghcr.io/${{ github.repository }}:${{ github.sha }}

Verify in Kubernetes (Kyverno Policy)

# Kubernetes policy: only deploy signed images
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: verify-image-signatures
spec:
  validationFailureAction: Enforce
  background: false
  rules:
    - name: verify-cosign-signature
      match:
        any:
          - resources:
              kinds: ["Pod"]
      verifyImages:
        - imageReferences:
            - "ghcr.io/myorg/*"
          attestors:
            - entries:
                - keyless:
                    subject: "https://github.com/myorg/*"
                    issuer: "https://token.actions.githubusercontent.com"
                    rekor:
                      url: "https://rekor.sigstore.dev"

Attestations

# Attest build provenance (SLSA)
cosign attest \
  --yes \
  --predicate provenance.json \
  --type slsaprovenance \
  myregistry.com/myapp:v1.2.3

# Verify attestation
cosign verify-attestation \
  --type spdxjson \
  --certificate-identity-regexp=".*@myorg.com" \
  --certificate-oidc-issuer=https://accounts.google.com \
  myregistry.com/myapp:v1.2.3

# Download and inspect attached SBOM
cosign download attestation myregistry.com/myapp:v1.2.3 | jq -r '.payload' | base64 -d | jq .

Installation

brew install cosign
# Or: go install github.com/sigstore/cosign/v2/cmd/cosign@latest
# Or: Download from https://github.com/sigstore/cosign/releases

Examples

Example 1: Setting up Cosign for a microservices project

User request:

I have a Node.js API and a React frontend running in Docker. Set up Cosign for monitoring/deployment.

The agent creates the necessary configuration files based on patterns like # Install, sets up the integration with the existing Docker setup, configures appropriate defaults for a Node.js + React stack, and provides verification commands to confirm everything is working.

Example 2: Troubleshooting ci/cd integration issues

User request:

Cosign is showing errors in our ci/cd integration. Here are the logs: [error output]

The agent analyzes the error output, identifies the root cause by cross-referencing with common Cosign issues, applies the fix (updating configuration, adjusting resource limits, or correcting syntax), and verifies the resolution with appropriate health checks.

Guidelines

  1. Keyless signing in CI — Use Sigstore's keyless signing in GitHub Actions; no key management, signatures tied to OIDC identity
  2. Sign every image — Sign in CI/CD, verify before deployment; no unsigned image should reach production
  3. Attach SBOMs — Generate and attach SBOM with every build; required for compliance (Executive Order 14028) and vulnerability tracking
  4. Verify in admission control — Use Kyverno or OPA to enforce signature verification at the Kubernetes admission level
  5. Rekor transparency log — Keyless signatures are recorded in Rekor; provides an immutable audit trail of who signed what and when
  6. Attestations for provenance — Attach SLSA provenance attestations; prove where and how the image was built
  7. Pin by digest — Reference images by SHA256 digest, not tag; tags can be overwritten, digests are immutable
  8. Vulnerability scan attestations — Attach scan results as attestations; verify no critical CVEs before deployment

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • Cosign 是 Sigstore 生态的核心工具,用于容器镜像签名、验证和元数据附加,解决云原生供应链安全的高频刚需问题。
  • 内容覆盖完整工作流:从本地签名验证、CI/CD 集成、Kubernetes 策略到 SBOM 和漏洞扫描附加,提供端到端实践指导。
  • 示例丰富,包含 GitHub Actions 集成、Kyverno 策略配置等真实场景,显著提升用户实施效率。
触发精准95/100

亮点

  • description 精准描述 Cosign 的核心功能和使用场景,触发词如 'container signing', 'supply chain security', 'sigstore', 'verify image' 等覆盖用户常见查询。
  • 边界清晰,无明显歧义或与其他 Skill 重叠的风险。
结构规范95/100

亮点

  • 文档结构清晰,包含 Overview、Instructions、Installation、Examples、Guidelines 等完整章节,步骤明确,出口条件清晰。
  • 每个部分有具体命令和配置示例,frontmatter 完整,单文件未超限。
执行可靠90/100

亮点

  • 所有命令和配置示例均基于官方 Cosign 和 Sigstore 实践,工具来源明确,参数正确。
  • 覆盖了 keyless signing、密钥对签名、SBOM 附加、漏洞扫描附加、Kubernetes 策略等关键场景,可靠性高。
证据可验 (前四项均值)94/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 33, 168 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • accounts.google.com
  • github.com
  • rekor.sigstore.dev
  • token.actions.githubusercontent.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。