implementing-code-signing-for-artifacts skill (Anthropic-Cybersecurity-Skills)
- Install
- SKILL.md (verbatim)
- When to Use
- Prerequisites
- Workflow
- Step 1: Generate and Manage Signing Keys
- Step 2: Sign Build Artifacts in CI/CD
- Step 3: Verify Signatures in Deployment Pipeline
- Step 4: Sign npm Packages with Provenance
- Key Concepts
- Tools & Systems
- Common Scenarios
- Scenario: Establishing Signed Release Pipeline
- Output Format
- Other files in this skill
- assets/template.md (verbatim)
- GitHub Actions: Build, Sign, and Release
- Verification Script
- references/api-reference.md (verbatim)
- Dependencies
- CLI Usage
- Functions
- generateed25519keypair(outputdir) -> dict
- signartifact(filepath, privatekeypath) -> dict
- verifysignature(filepath, signaturepath, publickeypath) -> dict
- verifycosignsignature(image) -> dict
- batchverify(artifacts, publickeypath) -> list
- cryptography API Used
- Output Schema
- references/standards.md (verbatim)
- SLSA Framework
- Level 1: Build Provenance
- Level 2: Signed Provenance
- Level 3: Hardened Build Platform
- NIST SSDF (SP 800-218)
- PS.2: Provide Mechanism for Verifying Software Release Integrity
- PW.4: Reuse Existing, Well-Secured Software
- CIS Software Supply Chain Security
- Artifacts (AR) Controls
- Executive Order 14028
- references/workflows.md (verbatim)
- Signing Pipeline Flow
- Signing Methods Comparison
What it does. 'Implements code signing for build artifacts (binaries, packages, containers) Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).
| Upstream | mukul975/Anthropic-Cybersecurity-Skills |
| Skill file | skills/implementing-code-signing-for-artifacts/SKILL.md |
| License | Apache-2.0 (skill folder LICENSE) |
| Author | mukul975 |
| Fetched | 2026-09-10 |
Install
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill implementing-code-signing-for-artifacts, or copy the skill folder into~/.claude/skills/implementing-code-signing-for-artifacts/.- Raw file:
curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/implementing-code-signing-for-artifacts/SKILL.md
SKILL.md (verbatim)
name: implementing-code-signing-for-artifacts
description: '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 SLSA Level
2+ provenance requirements.
'
domain: cybersecurity
subdomain: devsecops
tags:
- devsecops
- cicd
- code-signing
- supply-chain
- sigstore
- secure-sdlc
version: 1.0.0
author: mahipal
license: Apache-2.0
nist_csf:
- PR.PS-01
- GV.SC-07
- ID.IM-04
- PR.PS-04
mitre_attack:
- T1195
- T1554
- T1059.004
- T1610
- T1611
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 |
Tools & Systems
- GPG/PGP: Traditional asymmetric cryptography tool for signing and verifying artifacts
- Sigstore (cosign): Modern keyless signing infrastructure using OIDC identity and transparency logs
- Rekor: Sigstore's transparency log recording all signing events immutably
- Fulcio: Sigstore's certificate authority issuing short-lived certificates bound to OIDC identities
- notation: Microsoft's artifact signing tool for OCI registries (Project Notary v2)
Common Scenarios
Scenario: Establishing Signed Release Pipeline
Context: An open-source project needs to sign release artifacts so users can verify authenticity and detect tampering.
Approach:
- Use Sigstore keyless signing in GitHub Actions (no key management overhead)
- Sign all release binaries with
cosign sign-blobusing OIDC identity - Generate and sign checksums file for bulk verification
- Upload signatures, certificates, and checksums alongside release artifacts
- Document verification instructions in the project README
- Add verification step to the Homebrew formula or apt repository
Pitfalls: GPG key compromise requires revoking and re-signing all artifacts. Sigstore keyless signing avoids this by using ephemeral keys. Long-lived signing keys in CI/CD secrets are a supply chain risk if the CI system is compromised.
Output Format
Artifact Signing Report
========================
Pipeline: Build and Sign v2.3.0
Date: 2026-02-23
Signing Method: Sigstore Keyless + GPG
SIGNED ARTIFACTS:
app-v2.3.0-linux-amd64.tar.gz
GPG: PASS (ci-signing@company.com, EdDSA/Ed25519)
Sigstore: PASS (Rekor entry: 24658135, Fulcio cert issued)
SHA256: a1b2c3d4...
app-v2.3.0-darwin-arm64.tar.gz
GPG: PASS
Sigstore: PASS (Rekor entry: 24658136)
SHA256: e5f6g7h8...
checksums.sha256
GPG: PASS (detached signature)
TRANSPARENCY LOG:
Entries recorded: 3
Log index range: 24658135-24658137
Verification: https://search.sigstore.dev
Other files in this skill
- LICENSE
- assets/template.md
- references/api-reference.md
- references/standards.md
- references/workflows.md
- scripts/agent.py
- scripts/process.py
assets/template.md (verbatim)
Code Signing Templates
GitHub Actions: Build, Sign, and Release
name: Signed Release
on:
push:
tags: ['v*']
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Build
run: make build-all
- uses: sigstore/cosign-installer@v3
- name: Sign artifacts
run: |
for f in dist/*.tar.gz; do
cosign sign-blob "$f" --output-signature "${f}.sig" --output-certificate "${f}.cert" --yes
done
sha256sum dist/*.tar.gz > dist/checksums.sha256
- uses: softprops/action-gh-release@v2
with:
files: dist/*
Verification Script
#!/bin/bash
set -euo pipefail
# verify-release.sh <artifact> <signature> <certificate>
ARTIFACT="$1"
SIGNATURE="$2"
CERTIFICATE="$3"
echo "Verifying: $ARTIFACT"
sha256sum "$ARTIFACT"
cosign verify-blob "$ARTIFACT" \
--signature "$SIGNATURE" \
--certificate "$CERTIFICATE" \
--certificate-identity "https://github.com/org/repo/.github/workflows/release.yml@refs/tags/*" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com"
echo "Verification: PASSED"
references/api-reference.md (verbatim)
API Reference: Code Signing Verification Agent
Dependencies
| Library | Version | Purpose |
|---|---|---|
| cryptography | >=41.0 | Ed25519 key generation, signing, and verification |
CLI Usage
# Generate keypair
python scripts/agent.py --generate-keys --output-dir /keys/
# Sign artifact
python scripts/agent.py --sign build/app.tar.gz --private-key /keys/signing_key.pem
# Verify artifacts
python scripts/agent.py \
--artifacts build/app.tar.gz build/lib.so \
--public-key /keys/signing_key.pub \
--output-dir /reports/
Functions
generate_ed25519_keypair(output_dir) -> dict
Calls Ed25519PrivateKey.generate(), serializes to PEM using private_bytes() and public_bytes().
sign_artifact(file_path, private_key_path) -> dict
Loads PEM key via serialization.load_pem_private_key(), calls private_key.sign(data). Writes 64-byte signature to .sig file.
verify_signature(file_path, signature_path, public_key_path) -> dict
Loads public key, calls public_key.verify(signature, data). Catches InvalidSignature.
verify_cosign_signature(image) -> dict
Runs cosign verify <image> via subprocess for container image signature verification.
batch_verify(artifacts, public_key_path) -> list
Verifies multiple artifacts against the same public key.
cryptography API Used
| Class/Method | Purpose |
|---|---|
Ed25519PrivateKey.generate() |
Generate signing keypair |
private_key.sign(data) |
Sign data (returns 64 bytes) |
public_key.verify(signature, data) |
Verify signature |
serialization.load_pem_private_key() |
Load PEM private key |
Output Schema
{
"summary": {"total": 3, "valid": 2, "invalid": 1},
"verifications": [{"file": "app.tar.gz", "valid": true, "algorithm": "Ed25519"}]
}
references/standards.md (verbatim)
Standards Reference: Code Signing for Artifacts
SLSA Framework
Level 1: Build Provenance
- Document the build process (source, builder, dependencies)
- Provenance metadata available for all artifacts
Level 2: Signed Provenance
- Build provenance is signed by the build platform
- Signatures tied to authenticated builder identity
Level 3: Hardened Build Platform
- Build process runs on a hardened, isolated platform
- Provenance is non-falsifiable by the build service
NIST SSDF (SP 800-218)
PS.2: Provide Mechanism for Verifying Software Release Integrity
- PS.2.1: Make integrity verification information available to consumers
- Code signing provides cryptographic proof of artifact integrity
- Transparency logs provide public auditability of signing events
PW.4: Reuse Existing, Well-Secured Software
- Verify signatures of third-party dependencies before integration
- Establish trust anchors for acceptable signing identities
CIS Software Supply Chain Security
Artifacts (AR) Controls
- AR-1: Sign all build artifacts using cryptographic signatures
- AR-2: Verify artifact signatures before deployment
- AR-3: Use transparency logs for signing event auditability
- AR-4: Rotate signing keys on a defined schedule
Executive Order 14028
- Section 4(e): Agencies shall employ tools and processes to maintain trusted source code supply chains
- SBOM and artifact signing required for federal software suppliers
- Sigstore adoption recommended by CISA for open-source supply chain security
references/workflows.md (verbatim)
Workflow Reference: Code Signing for Artifacts
Signing Pipeline Flow
Build Artifacts
│
▼
┌──────────────────┐
│ Generate │
│ Checksums │
└──────┬───────────┘
│
├──────────────────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ GPG Sign │ │ Sigstore │
│ (detached) │ │ Keyless Sign │
└──────┬───────┘ └──────┬───────┘
│ │
│ ▼
│ ┌──────────────┐
│ │ Rekor Log │
│ │ Entry │
│ └──────┬───────┘
│ │
└──────────┬─────────┘
▼
┌──────────────────┐
│ Publish Release │
│ + Signatures │
└──────────────────┘
Signing Methods Comparison
| Method | Key Management | Identity | Verification | Best For |
|---|---|---|---|---|
| GPG | Manual key lifecycle | Key fingerprint | gpg --verify | Traditional projects |
| Sigstore Keyless | No keys to manage | OIDC identity | cosign verify-blob | Modern CI/CD |
| Code Signing Cert | CA-issued certificate | Organization name | Platform-specific | Windows/macOS apps |
| npm Provenance | Automated | GitHub Actions OIDC | npm audit signatures | npm packages |
Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.