-
Notifications
You must be signed in to change notification settings - Fork 19
chore: Create and rework docs for topic Security & Trust #731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
morri-son
wants to merge
38
commits into
open-component-model:main
Choose a base branch
from
morri-son:create-new-security-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
1c9e785
add new how-tos and concept
morrison-sap a3b0fb1
adopt existing guides to how-to design and move to different folder
morrison-sap 001e4d2
rework tutorial in diataxis format
morrison-sap f19bed5
add guide to configure crendentials for OCM controllers
morrison-sap 70a82af
correct linter issues
morrison-sap b5a98ef
correct linter issues
morrison-sap 8f92710
correct linter issues
morrison-sap 4721578
correct spellcheck issues
morrison-sap b20b464
correct linter issues
morrison-sap fb37a0d
merge from upstream/main
morrison-sap 51f5b25
adopt better to diataxis: move best practices from concept to tutoria…
morrison-sap 7b303e6
rebase
morrison-sap 1d5870b
correct broken links
morrison-sap 3e276de
correct broken links
morrison-sap 88d688c
update hugo
morrison-sap 8bd0cf1
correct linter issues
morrison-sap 08b3fed
correct linter issues
morrison-sap a0cd980
Merge branch 'main' into create-new-security-docs
matthiasbruns 863a944
Merge remote-tracking branch 'upstream/main' into create-new-security…
morrison-sap 4ef9aae
correct order of docs, now starting with weight=1 gor the first doc o…
morrison-sap 0df5847
Merge branch 'create-new-security-docs' of github.com:morri-son/ocm-w…
morrison-sap 294479d
restore key pair creation
morrison-sap a6bcfdc
add callout for sigstore support and change version for jsonNormalisa…
morrison-sap b80de4d
change order
morrison-sap 0b28a10
Merge remote-tracking branch 'upstream/main' into create-new-security…
morrison-sap 1ae9c35
remove hugo update from this PR
morrison-sap c2697e6
remove hugo update from this PR
morrison-sap 494ce80
replace `~` with $HOME everwhere. Use example component from getting …
morrison-sap 62d2ad2
correct docs and integrate feedback from reviewers.
morrison-sap 0aca291
move tutorial to correct ocm cli v2 commands and test.
morrison-sap 5b1ff09
add back link to json normalization in the ocm spec.
morrison-sap ae43a39
add reference for consumer identities and link it from the other docs.
morrison-sap 465cd05
update with decriptor
morrison-sap 9221dd9
add signatureEncodingPolicy section and explain Plain vs. PEM
morrison-sap 51ca1eb
Apply suggestions from code review
morri-son 27c7c6f
hide large decriptor example behind {{< details >}} section
morrison-sap b5b2ca6
Merge branch 'main' into create-new-security-docs
morri-son 89b8d0c
Merge remote-tracking branch 'upstream/main' into create-new-security…
morrison-sap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
261 changes: 261 additions & 0 deletions
261
content/docs/concepts/signing-and-verification-concept.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,261 @@ | ||
| --- | ||
| title: "Signing and Verification" | ||
| description: "Understanding how OCM ensures component integrity and authenticity through cryptographic signatures." | ||
| weight: 5 | ||
| toc: true | ||
| --- | ||
|
|
||
| OCM uses cryptographic signatures to guarantee that component versions are authentic (created by a trusted party) and have not been tampered with during storage or transfer. | ||
|
|
||
| ## Why Sign Components? | ||
|
|
||
| Software supply chains involve multiple stages: development, build, packaging, distribution, and deployment. At each stage, components could potentially be: | ||
|
|
||
| - **Modified** — malicious actors could inject code or alter resources | ||
| - **Replaced** — components could be swapped for compromised versions | ||
| - **Misattributed** — components could falsely claim to come from a trusted source | ||
morri-son marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Signing addresses these risks by creating a cryptographic proof of: | ||
|
|
||
| 1. **Integrity**: The component has not changed since it was signed | ||
| 2. **Authenticity**: The signature was created by someone with access to the private key | ||
| 3. **Provenance**: The signer cannot deny having signed the component | ||
|
|
||
| ## How OCM Signing Works | ||
|
|
||
| ```mermaid | ||
| flowchart TB | ||
| subgraph sign ["Sign (Producer)"] | ||
| direction TB | ||
| A[Component Version] --> B[Normalize & Hash] | ||
| B --> C[Sign with Private Key] | ||
| C --> D["Signature embedded in CV"] | ||
| end | ||
|
|
||
| sign --> T["Transfer Component Version"] | ||
|
|
||
| T --> verify | ||
|
|
||
| subgraph verify ["Verify (Consumer)"] | ||
| direction TB | ||
| E[Component Version] --> F[Extract Signature] | ||
| E --> G[Normalize & Hash] | ||
| F --> H[Verify with Public Key] | ||
| G --> H | ||
| H --> I{Valid?} | ||
| I -->|Yes| VALID["✓ Trusted"] | ||
| I -->|No| INVALID["✗ Rejected"] | ||
| end | ||
| ``` | ||
|
|
||
| ### Normalization and Digest Calculation | ||
|
|
||
| OCM uses a two-layer approach to ensure consistent and reproducible digests: | ||
|
|
||
| #### Component Descriptor Normalization | ||
|
|
||
| Before hashing, the component descriptor is normalized into a canonical form, eliminating any ambiguities | ||
| that could cause the same logical descriptor to produce different digests. The default normalization | ||
| algorithm ([`jsonNormalisation/v4alpha1`](https://github.com/open-component-model/ocm-spec/blob/main/doc/04-extensions/04-algorithms/component-descriptor-normalization-algorithms.md#normalization-algorithms)) defines exactly how this canonical form is derived, ensuring | ||
| identical component descriptors always yield the same digest. | ||
|
|
||
| #### Artifact Digest Normalization | ||
|
|
||
| Each artifact's digest is calculated using a type-specific normalization algorithm: | ||
|
|
||
| | Artifact Type | Algorithm | Description | | ||
| |---------------|-----------|-------------| | ||
| | OCI artifact | `ociArtifactDigest/v1` | Digest of the OCI manifest (used for container images, Helm charts, and other OCI-native content) | | ||
| | Generic blob | `genericBlobDigest/v1` | Direct hash of blob content (used for executables, blueprints, and other non-OCI content) | | ||
|
|
||
| This allows OCM to use the most appropriate digest mechanism for each artifact type. | ||
| OCI artifacts use their manifest digest rather than re-hashing the blob, | ||
| improving performance and ensuring consistency with OCI registry behavior. Generic blobs are hashed directly. | ||
|
|
||
| #### Recursive Component References | ||
|
|
||
| When a component references other components, their digests are calculated recursively and embedded: | ||
morri-son marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| references: | ||
| - componentName: ocm.software/helper | ||
| name: helper | ||
| version: 1.0.0 | ||
| digest: | ||
| hashAlgorithm: SHA-256 | ||
| normalisationAlgorithm: jsonNormalisation/v4alpha1 | ||
| value: 01c211f5c9cfd7c40e5b84d66a2fb7d19cb0... | ||
| ``` | ||
|
|
||
| This creates a **complete integrity chain** — verifying the root component automatically verifies all transitive dependencies. | ||
|
|
||
| ### What Gets Signed? | ||
|
|
||
| OCM signs a **digest** of the component descriptor, which includes: | ||
|
|
||
| - Component metadata (name, version, provider) | ||
| - Resource declarations with their digests | ||
| - Source references | ||
| - Component references | ||
morri-son marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The signature does **not** cover the raw resource content directly — instead, it covers the **digests** of those resources as recorded in the component descriptor. Crucially, the `access` field (which describes *where* a resource is stored) is **excluded** from the signed digest by the normalization process. This is a key design principle: | ||
|
|
||
| - **Location-independent integrity** — a component version can be transferred to a different registry (changing all `access` references) without invalidating its signature. The digest remains stable because it depends only on *what* the artifacts contain, not *where* they are stored. | ||
| - Any change to resource content changes its digest, invalidating the signature. | ||
| - Signature verification is fast (no need to re-hash large binaries). | ||
|
|
||
| This separation of content identity from storage location is what enables secure delivery across environments: a producer signs a component version once, and consumers can verify it after any number of transfers — even into air-gapped environments with completely different registries. | ||
|
|
||
| The following example shows a signed component descriptor. Notice that each resource has both an `access` field (storage location) and a `digest` field (content hash). Only the `digest` is included in the signature — the `access` can change freely during transfers: | ||
|
|
||
| {{< details "Example Signed Component Descriptor" >}} | ||
| ```yaml | ||
| component: | ||
| name: github.com/acme.org/helloworld | ||
| version: 1.0.0 | ||
| provider: acme.org | ||
| resources: | ||
| - name: mylocalfile | ||
| type: blob | ||
| version: 1.0.0 | ||
| relation: local | ||
| access: # NOT included in signature | ||
| type: localBlob | ||
| localReference: sha256:70a257... | ||
| mediaType: text/plain; charset=utf-8 | ||
| digest: # Included in signature | ||
| hashAlgorithm: SHA-256 | ||
| normalisationAlgorithm: genericBlobDigest/v1 | ||
| value: 70a2577d7b649574cbbba99a2f2ebdf27904a4abf80c9729923ee67ea8d2d9d8 | ||
| - name: image | ||
| type: ociImage | ||
| version: 1.0.0 | ||
| relation: external | ||
| access: # NOT included in signature | ||
| type: ociArtifact | ||
| imageReference: ghcr.io/stefanprodan/podinfo:6.9.1@sha256:262578cd... | ||
| digest: # Included in signature | ||
| hashAlgorithm: SHA-256 | ||
| normalisationAlgorithm: genericBlobDigest/v1 | ||
| value: 262578cde928d5c9eba3bce079976444f624c13ed0afb741d90d5423877496cb | ||
| signatures: | ||
| - name: default | ||
| digest: | ||
| hashAlgorithm: SHA-256 | ||
| normalisationAlgorithm: jsonNormalisation/v4alpha1 | ||
| value: 91dd197868907487e62872695db1fa7b397fde300bcbae23e24abc188fb147ad | ||
| signature: | ||
| algorithm: RSASSA-PSS | ||
| mediaType: application/vnd.ocm.signature.rsa.pss | ||
| value: 7feb449229c6ffe368144995432befd1505d2d29... | ||
| ``` | ||
| {{< /details >}} | ||
|
|
||
| ### Signature Storage | ||
|
|
||
| Signatures are stored as part of the component version: | ||
|
|
||
| ```yaml | ||
| signatures: | ||
| - name: acme-release-signing | ||
| digest: | ||
| hashAlgorithm: SHA-256 | ||
| normalisationAlgorithm: jsonNormalisation/v4alpha1 | ||
| value: abc123... | ||
| signature: | ||
| algorithm: RSASSA-PSS | ||
| mediaType: application/vnd.ocm.signature.rsa | ||
| value: <base64-encoded-signature> | ||
| ``` | ||
|
|
||
| A component version can have **multiple signatures** from different parties, enabling: | ||
|
|
||
| - Separation of build and release signing | ||
| - Multiple approval workflows | ||
| - Cross-organizational trust chains | ||
|
|
||
| ## Supported Signing Algorithms | ||
|
|
||
| OCM currently only supports RSA-based signing algorithms: | ||
|
|
||
| | Algorithm | Type | Characteristics | | ||
| |----------------------|------|-----------------| | ||
| | RSASSA-PSS (default) | Asymmetric | Probabilistic, stronger security guarantees, recommended for new implementations | | ||
| | RSA-PKCS#1 v1.5 | Asymmetric | Deterministic, widely supported, compatible with legacy systems | | ||
|
|
||
| To override the default signing algorithm or encoding policy, see the --signer-spec flag in the [CLI reference]({{< relref "/docs/reference/ocm-cli/ocm_sign_component-version.md" >}}). | ||
| The signer spec file configures only the algorithm and encoding policy — credentials are always resolved separately via the [`.ocmconfig`]({{< relref "configure-multiple-credentials.md" >}}) file. | ||
|
|
||
| For key management, OCM uses PEM-encoded key files configured in the `.ocmconfig`: | ||
morri-son marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - **Private keys**: Used by producers to sign component versions | ||
| - **Public keys**: Distributed to consumers for verification | ||
|
|
||
| See [How-to: Generate Signing Keys]({{< relref "docs/how-to/generate-signing-keys.md" >}}) for creating RSA key pairs. | ||
|
|
||
| {{< callout context="tip" title="Upcoming Sigstore Support" icon="outline/bulb" >}} | ||
| We are planning to add support for [Sigstore](https://www.sigstore.dev/) and Cosign as an additional signing mechanism. | ||
| This will enable keyless signing workflows and improved supply chain security. Stay tuned for updates. | ||
| {{< /callout >}} | ||
|
|
||
| ### Signature Encoding Policies | ||
|
|
||
| The `signatureEncodingPolicy` in the [signer spec]({{< relref "/docs/reference/ocm-cli/ocm_sign_component-version.md" >}}) controls how the **signature output** is serialized and stored. It does **not** affect the format of key input files, which are always PEM-encoded. | ||
|
|
||
| | Policy | Signature Format | Media Type | Certificate Chain | Verification Requires | | ||
| |--------|-----------------|------------|-------------------|-----------------------| | ||
| | **Plain** (default) | Hex-encoded raw bytes | `application/vnd.ocm.signature.rsa.pss` | Not embedded | Externally supplied public key | | ||
| | **PEM** (experimental) | PEM `SIGNATURE` block + `CERTIFICATE` blocks | `application/x-pem-file` | Embedded in signature | Valid certificate chain in signature | | ||
|
|
||
| #### Plain Encoding (Default) | ||
|
|
||
| The raw RSA signature bytes are hex-encoded and stored directly. This is the most compact representation. Verification always requires the public key to be provided separately via `.ocmconfig` credentials. | ||
|
|
||
| Example signature in a component descriptor: | ||
|
|
||
| ```yaml | ||
| signature: | ||
| algorithm: RSASSA-PSS | ||
| mediaType: application/vnd.ocm.signature.rsa.pss | ||
| value: d1ea6e0cd850c8dbd0d20cd39b9c7954... | ||
| ``` | ||
|
|
||
| #### PEM Encoding (Experimental) | ||
|
|
||
| The signature is wrapped in a PEM block of type `SIGNATURE`, optionally followed by the signer's X.509 certificate chain. This makes the signature **self-contained**: verifiers can extract and validate the public key from the embedded chain without needing a separately distributed key. | ||
|
|
||
| Example of a PEM-encoded signature value: | ||
|
|
||
| ```text | ||
| -----BEGIN SIGNATURE----- | ||
| Signature Algorithm: RSASSA-PSS | ||
| <base64-encoded signature bytes> | ||
| -----END SIGNATURE----- | ||
| -----BEGIN CERTIFICATE----- | ||
| <leaf certificate> | ||
| -----END CERTIFICATE----- | ||
| -----BEGIN CERTIFICATE----- | ||
| <intermediate CA> | ||
| -----END CERTIFICATE----- | ||
| ``` | ||
|
|
||
| {{< callout context="caution" title="PEM encoding is experimental" icon="outline/alert-triangle" >}} | ||
| This encoding policy may change or be deprecated in future versions. For production use, prefer the default Plain encoding. | ||
| {{< /callout >}} | ||
|
|
||
| {{< callout context="note" title="Key files vs. signature encoding" icon="outline/info-circle" >}} | ||
| A common source of confusion: "PEM" in `signatureEncodingPolicy` refers to the **signature output** format, not the key input format. Input keys are **always** PEM-encoded files (e.g. `-----BEGIN RSA PRIVATE KEY-----`), regardless of which encoding policy is selected. | ||
|
|
||
| When using PEM encoding for signing, the credential referenced by `public_key_pem` / `public_key_pem_file` must contain **X.509 certificates** (not bare public keys), because the certificate chain is embedded into the signature for self-contained verification. | ||
| {{< /callout >}} | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [How-to: Generate Signing Keys]({{< relref "generate-signing-keys.md" >}}) - Step-by-step creating RSA key pairs. | ||
| - [How-to: Configure Signing Credentials]({{< relref "configure-signing-credentials.md" >}}) - Set up OCM to use your keys for signing and verification | ||
| - [How-to: Sign a Component Version]({{< relref "sign-component-version.md" >}}) - Step-by-step signing instructions | ||
| - [How-to: Verify a Component Version]({{< relref "verify-component-version.md" >}}) - Step-by-step verification instructions | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [Concept: Component Versions]({{< relref "components.md" >}}) - Understanding component structure | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.