Chuyển đến nội dung
Skillpedia
Lập trình chung35k · #8016

implementing-code-signing-for-artifacts

Skill này làm gì

Công cụ này thêm “chữ ký số” vào các tệp chương trình của bạn. Điều này đảm bảo tệp không bị giả mạo và đến từ nguồn đáng tin cậy, giống như con dấu xác thực.

Khi nào nên dùng

  • ✓Khi bạn muốn đảm bảo tệp chương trình không bị hacker sửa đổi.
  • ✓Khi bạn cần chứng minh cho khách hàng rằng phần mềm thực sự là của bạn và không bị can thiệp.
  • ✓Khi bạn muốn hệ thống tự động từ chối mọi chương trình thiếu “chữ ký” chính thức này.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-code-signing-for-artifacts/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-code-signing-for-artifacts/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Ký số các tệp chương trình của tôi để đảm bảo chúng không bị giả mạo.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng các phương pháp mật mã (như GPG hoặc Sigstore) để tạo chữ ký duy nhất cho từng tệp. Chữ ký này sau đó được kiểm tra để xác nhận tính toàn vẹn và nguồn gốc của tệp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Implementing Code Signing for Artifacts

When to Use

  • When establishing artifact integrity verification to prevent supply chain tampering
  • When compliance requires cryptographic proof that build artifacts are authentic and unmodified
  • When distributing software to customers who need to verify publisher identity
  • When implementing zero-trust deployment pipelines that reject unsigned artifacts
  • When meeting SLSA Level 2+ requirements for provenance and integrity

Do not use for encrypting artifacts (signing provides integrity, not confidentiality), for container image signing specifically (use cosign), or for source code authentication (use commit signing).

Prerequisites

  • GPG key pair for traditional signing or Sigstore account for keyless signing
  • Code signing certificate from a Certificate Authority for public distribution
  • CI/CD pipeline with access to signing keys or identity provider
  • Verification infrastructure in deployment pipelines

Workflow

Step 1: Generate and Manage Signing Keys

# Generate GPG key for artifact signing
gpg --full-generate-key --batch <<EOF
Key-Type: eddsa
Key-Curve: ed25519
Subkey-Type: eddsa
Subkey-Curve: ed25519
Name-Real: CI Build System
Name-Email: ci-signing@company.com
Expire-Date: 1y
%no-protection
EOF

# Export public key for distribution
gpg --armor --export ci-signing@company.com > signing-key.pub

# Export private key for CI/CD (store in secrets manager)
gpg --armor --export-secret-keys ci-signing@company.com > signing-key.priv

Step 2: Sign Build Artifacts in CI/CD

# .github/workflows/build-sign.yml
name: Build and Sign

on:
  push:
    tags: ['v*']

jobs:
  build-sign:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write  # For Sigstore keyless signing
    steps:
      - uses: actions/checkout@v4

      - name: Build artifacts
        run: |
          make build
          sha256sum dist/* > dist/checksums.sha256

      - name: Import GPG Key
        run: |
          echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
          gpg --list-secret-keys

      - name: Sign artifacts
        run: |
          for file in dist/*; do
            gpg --detach-sign --armor --local-user ci-signing@company.com "$file"
          done

      - name: Install cosign for keyless signing
        uses: sigstore/cosign-installer@v3

      - name: Keyless sign with Sigstore
        run: |
          for file in dist/*.tar.gz; do
            cosign sign-blob "$file" \
              --output-signature "${file}.sig" \
              --output-certificate "${file}.cert" \
              --yes
          done

      - name: Create Release with signed artifacts
        uses: softprops/action-gh-release@v2
        with:
          files: |
            dist/*
            dist/*.asc
            dist/*.sig
            dist/*.cert

Step 3: Verify Signatures in Deployment Pipeline

# Verify GPG signature
gpg --import signing-key.pub
gpg --verify artifact.tar.gz.asc artifact.tar.gz

# Verify Sigstore keyless signature
cosign verify-blob artifact.tar.gz \
  --signature artifact.tar.gz.sig \
  --certificate artifact.tar.gz.cert \
  --certificate-identity ci-signing@company.com \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

# Verify checksums
sha256sum --check checksums.sha256

Step 4: Sign npm Packages with Provenance

{
  "scripts": {
    "prepublishOnly": "npm run build && npm run test"
  },
  "publishConfig": {
    "provenance": true
  }
}
# Publish npm package with provenance attestation
npm publish --provenance

Key Concepts

Term Definition
Code Signing Cryptographic process of signing software artifacts to verify publisher identity and artifact integrity
Detached Signature Signature stored in a separate file from the artifact, allowing independent distribution
Keyless Signing Sigstore's approach using short-lived certificates tied to OIDC identities instead of long-lived keys
Provenance Metadata describing how, where, and by whom an artifact was built
Transparency Log Append-only log (Rekor) that records all signing events for public auditability
Trust Chain Hierarchical chain from root CA to signing certificate establishing trust in the signer's identity
SLSA Supply-chain Levels for Software Artifacts — framework defining levels of supply chain security

…

Câu hỏi thường gặp

Chữ ký số là gì?

Đó giống như con dấu bảo mật, chứng minh một tệp là xác thực và chưa bị thay đổi kể từ khi được ký.

Ký và mã hóa khác nhau thế nào?

Ký đảm bảo tính xác thực và toàn vẹn (ai tạo ra và có bị thay đổi không). Mã hóa bảo vệ nội dung, khiến nó không đọc được nếu không có khóa.

Tôi có cần khóa đặc biệt để ký không?

Có, bạn cần một cặp khóa (công khai và riêng tư), hoặc dùng dịch vụ như Sigstore để quản lý việc này đơn giản hơn (không cần khóa).

Chi tiết

Mô tả gốc của tác giả

Implements code signing for build artifacts (binaries, packages, containers) using GPG, Sigstore, and platform-specific signing tools, establishing trust chains and verifying signatures in deployment pipelines. Use when establishing artifact integrity checks against supply-chain tampering, proving authenticity to customers, building zero-trust pipelines that reject unsigned artifacts, or meeting S

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#8016
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự