|
| 1 | +# Sigstore Integration for OCM |
| 2 | + |
| 3 | +* Status: approved |
| 4 | +* Deciders: OCM Maintainer Team |
| 5 | +* Date: 2026-04-15 |
| 6 | + |
| 7 | +Technical Story: This ADR outlines the decision on how to integrate Sigstore/Cosign keyless signing |
| 8 | +into the OCM CLI, comparing a CLI wrapper approach with a direct library integration. |
| 9 | + |
| 10 | +## Context and Problem Statement |
| 11 | + |
| 12 | +Traditional code signing requires managing long-lived keys, which is complex and lacks a public record of signing events. Sigstore offers a solution by binding signatures to identities (email, CI workload) using short-lived certificates and an immutable transparency log, eliminating the need for long-lived keys. |
| 13 | + |
| 14 | +OCM's current signing system is based on a `signing.Handler` interface, which is agnostic to the underlying signing algorithm. To integrate Sigstore, a new implementation of this interface is required. This ADR evaluates two primary approaches for this integration. |
| 15 | + |
| 16 | +## Decision Drivers |
| 17 | + |
| 18 | +- **User Experience:** The end user should only need to install and interact with the `ocm` CLI. Any additional tools should be managed transparently. |
| 19 | +- **Dependency Management:** The number of third-party dependencies should be minimized to reduce the supply chain attack surface and maintenance overhead. |
| 20 | +- **Maturity and Stability:** The chosen solution should be based on a mature, battle-tested implementation of the Sigstore protocol. |
| 21 | +- **Maintainability:** The integration should be easy to maintain and upgrade. |
| 22 | + |
| 23 | +## Considered Options |
| 24 | + |
| 25 | +- **Option A: Cosign CLI Wrapper:** Delegate all Sigstore operations to the `cosign` binary as an external process. The handler would manage the `cosign` binary transparently (auto-download, caching). |
| 26 | +- **Option B: sigstore-go Library:** Use the official `sigstore-go` library to perform signing and verification operations entirely in-process. |
| 27 | + |
| 28 | +## Decision Outcome |
| 29 | + |
| 30 | +Chosen [Option A](#option-a-cosign-cli-wrapper): "Cosign CLI Wrapper". |
| 31 | + |
| 32 | +Justification: |
| 33 | + |
| 34 | +- **Minimal Dependency Risk:** This option adds zero new Go dependencies to the OCM module, leveraging the most mature and widely-used Sigstore client (`cosign`). |
| 35 | +- **Clean Architecture:** The proposed `Executor` interface provides a clean abstraction that is easily testable. |
| 36 | +- **Seamless User Experience:** The `cosign` binary is managed automatically by the OCM CLI, making it invisible to the end-user. The user experience is a true single-tool experience. |
| 37 | +- **Familiarity:** The configuration model mirrors `cosign` conventions, which is beneficial for users already familiar with it. |
| 38 | + |
| 39 | +The main trade-off (dependency on an external binary) is fully mitigated by the transparent auto-download and |
| 40 | +caching mechanism with SHA256 verification of the downloaded binary. |
| 41 | + |
| 42 | +## Pros and Cons of the Options |
| 43 | + |
| 44 | +### Option A: Cosign CLI Wrapper |
| 45 | + |
| 46 | +Pros: |
| 47 | + |
| 48 | +- Zero sigstore Go dependencies. |
| 49 | +- `cosign` is the battle-tested reference implementation. |
| 50 | +- Clean `Executor` abstraction for testing. |
| 51 | +- Automatic feature inheritance by updating the `cosign` binary. |
| 52 | +- No manual tool installation for the user. |
| 53 | +- Familiar UX for `cosign` users. |
| 54 | + |
| 55 | +Cons: |
| 56 | + |
| 57 | +- Text-based error handling from `stderr`. |
| 58 | +- Implicit version coupling with the `cosign` binary. |
| 59 | +- Network access required for the initial download of the `cosign` binary. |
| 60 | + |
| 61 | +### Option B: sigstore-go Library |
| 62 | + |
| 63 | +Pros: |
| 64 | + |
| 65 | +- Self-contained with no external binary. |
| 66 | +- Typed Go error handling. |
| 67 | +- Fine-grained control over the Sigstore process. |
| 68 | + |
| 69 | +Cons: |
| 70 | + |
| 71 | +- Heavy dependency tree with over 15 transitive modules. |
| 72 | +- Larger supply chain attack surface. |
| 73 | +- Tighter coupling with the `sigstore-go` API, requiring recompilation for updates. |
| 74 | +- `sigstore-go` is less mature than the `cosign` CLI. |
| 75 | +- A panic in the library could crash the OCM CLI. |
| 76 | + |
| 77 | +## Discovery and Distribution |
| 78 | + |
| 79 | +The Sigstore handler will be implemented as an internal OCM plugin. |
| 80 | +The `cosign` binary will be downloaded on-demand and cached in the user's home directory (`~/.cache/ocm/cosign/...`). |
| 81 | +The version of `cosign` will be pinned and managed by Renovate. The user will interact with the feature through the standard `ocm sign` and `ocm verify` commands, |
| 82 | +with `sigstore` as the algorithm name. |
| 83 | + |
| 84 | +## Conclusion |
| 85 | + |
| 86 | +Option A provides a pragmatic and robust solution for integrating Sigstore signing into OCM. It minimizes dependencies, |
| 87 | +leverages a mature toolchain, and provides a seamless experience for the end-user. |
| 88 | +The architecture is clean, maintainable, and flexible for future evolution. |
0 commit comments