implementing-code-signing-for-artifacts
This skill covers implementing code signing for build artifacts to ensure integrity and authenticity throughout the software supply chain. It addresses signing binaries, packages, and containers using GPG, Sigstore, and platform-specific signing tools, establishing trust chains, and verifying signatures in deployment pipelines.
What this skill does
# 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 ```bash # 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: [email protected] Expire-Date: 1y %no-protection EOF # Export public key for distribution gpg --armor --export [email protected] > signing-key.pub # Export private key for CI/CD (store in secrets manager) gpg --armor --export-secret-keys [email protected] > signing-key.priv ``` ### Step 2: Sign Build Artifacts in CI/CD ```yaml # .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 [email protected] "$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 ```bash # 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 [email protected] \ --certificate-oidc-issuer https://token.actions.githubusercontent.com # Verify checksums sha256sum --check checksums.sha256 ``` ### Step 4: Sign npm Packages with Provenance ```json { "scripts": { "prepublishOnly": "npm run build && npm run test" }, "publishConfig": { "provenance": true } } ``` ```bash # 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**: 1. Use Sigstore keyless signing in GitHub Actions (no key management overhead) 2. Sign all release binaries with `cosign sign-blob` using OIDC identity 3. Generate and sign checksums file for bulk verification 4. Upload signatures, certificates, and checksums alongside release artifacts 5. Document verification instructions in the project README 6. 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 ([email protected], 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 ```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.