Add cryptographic signing for WASM OCI artifacts with digest-based security#154
Conversation
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
|
@duffney we should probably dry-run the examples.yml for each PR so that we know when the pipeline is working vs. not working |
By dry-run do you mean run the workflow and just not publish the artifacts? |
yeah exactly |
If the artifact isn't pushed, you'll also have to skip the signing steps. Cosign expects the image its signing to be hosted on a registry. imo, having it run when a new release is cut should be frequent enough. |
|
okay, could you please review this PR and let me know if it's good to merge? @duffney |
|
@copilot when you sign the oci artifact you need to use the digest instead of the tag, which in this case is Here is an example: |
Co-authored-by: duffney <8146181+duffney@users.noreply.github.com>
Updated the signing commands to use digest instead of tag as recommended. Added IDs to the publish steps ( |
|
@copilot the sbom generated by Syft only includes the oci artifact for the wasm file. It doesn't include any details about the dependencies that the wasm component uses. To get that detail you'll have to build the components with Here's an example workflow. The important steps are: - name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@v1.10.15
name: Install build dependencies
continue-on-error: false
run: |
cargo binstall cargo-component --force --version ${{ env.CARGO_COMPONENT_VERSION }}
cargo binstall wkg --force
cargo binstall cargo-auditable cargo-audit
cargo binstall auditable2cdx
- name: Build the component
run: cargo auditable component build --release
- name: Extract the SBOM from the component
run: auditable2cdx target/wasm32-wasip1/release/${{ env.COMPONENT_NAME_UNDERSCORED }} >> ${{ env.COMPONENT_NAME }}.spdx.json
- name: Sign the SBOM for the latest Wasm component
if: github.event_name != 'workflow_dispatch'
run: cosign attest --yes --type spdxjson --predicate ${{ env.COMPONENT_NAME }}.spdx.json ghcr.io/${{ env.IMAGE_NAME }}/${{ env.COMPONENT_NAME }}@${{ steps.publish_latest.outputs.digest }} |
Co-authored-by: duffney <8146181+duffney@users.noreply.github.com>
Updated the SBOM generation to use
The Rust SBOMs now contain complete dependency information instead of just the OCI artifact metadata. Fixed in ff703c2. |
🔍 Security Audit WarningsThe Click to view cargo audit outputThese are warnings (not vulnerabilities) but should be reviewed for:
The security job will continue to pass as these are warnings, not blocking security issues. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Co-authored-by: duffney <8146181+duffney@users.noreply.github.com>
Removed all SBOM generation steps from the workflow as requested, keeping only the cryptographic signing of WASM OCI artifacts. The workflow now focuses solely on signing with Cosign using digest-based references. Fixed in a6219b4.
Removed all SBOM generation steps from the workflow as requested, keeping only the cryptographic signing of WASM OCI artifacts. The workflow now focuses solely on signing with Cosign using digest-based references. Fixed in a6219b4. |
|
@copilot you forgot to update the Justfile at the root of the repo. |
…ust examples Co-authored-by: duffney <8146181+duffney@users.noreply.github.com>
Updated the Justfile to use Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@Mossaka LGTM. I had copilot remove the sbom because it's empty without the ability to parse the dependencies of the component. But the signing is working! A later feature is we could setup wassette so it only run signed components. |
This PR adds cryptographic signing capabilities to the wassette project's examples workflow, enhancing supply chain security for all published container images.
Key Security Features
Container Image Signing: All published images are cryptographically signed using Cosign with keyless signing via GitHub's OIDC tokens, providing verifiable authenticity and integrity.
Digest-Based Security: All signing operations use immutable digest references (
@sha256:...) instead of mutable tags to prevent tag mutation attacks and ensure we're signing the exact artifact that was published.Implementation
The workflow automatically signs all six example components (
gomodule-go,eval-py,time-server-js,get-weather-js,filesystem-rs,fetch-rs) for both commit SHA-tagged and latest/custom-tagged images. The signing process uses GitHub's OIDC identity tokens for keyless signing, eliminating the need to manage signing keys while providing strong cryptographic verification.The solution maintains backward compatibility with existing build processes while adding this critical security layer for artifact verification.
Fixes #153.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.