Skip to content

Commit f2c9acf

Browse files
authored
chore(docs): Update quickstart on documentation to include policies (chainloop-dev#1866)
Signed-off-by: Javier Rodriguez <[email protected]>
1 parent f4a6790 commit f2c9acf

File tree

4 files changed

+96
-10
lines changed

4 files changed

+96
-10
lines changed

docs/docs/quickstart.mdx

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,74 @@ This quickstart will guide you through the process of installing the Chainloop C
5050
Chainloop workflows represent any CI or process you might want to attest. Check [this doc](/getting-started/workflow-definition) for a complete explanation of Workflows and Contracts.
5151
You might also want to check our [contract reference](/reference/operator/contract).
5252

53+
We can check what kind materials the contract expects by checking the output of `attestation init` command:
54+
5355
```bash
54-
chainloop att init --workflow mywf --project myproject
56+
chainloop att init --workflow mywf --project myproject --contract https://raw.githubusercontent.com/chainloop-dev/chainloop/refs/heads/main/docs/examples/quickstart/quickstart-contract.yaml
57+
INF Attestation initialized! now you can check its status or add materials to it
58+
┌───────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┐
59+
│ Initialized At │ 27 Feb 25 13:26 UTC │
60+
├───────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┤
61+
│ Attestation ID │ 64ae145e-5424-4f67-8dee-ae42dccfb6e4 │
62+
│ Organization │ quickstart-10122 │
63+
│ Name │ mywf │
64+
│ Project │ myproject │
65+
│ Version │ v0.175.0 (prerelease) │
66+
│ Contract │ quickstart-contract (revision 1) │
67+
│ Policy violation strategy │ ADVISORY │
68+
│ Policies │ ------ │
69+
│ │ containers-with-sbom: skipped - there are no container images in the attestation │
70+
│ │ sbom-present: missing SBOM material │
71+
└───────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┘
72+
┌───────────────────────────────────┐
73+
│ Materials │
74+
├──────────┬────────────────────────┤
75+
│ Name │ container │
76+
│ Type │ CONTAINER_IMAGE │
77+
│ Set │ No │
78+
│ Required │ Yes │
79+
├──────────┼────────────────────────┤
80+
│ Name │ sbom │
81+
│ Type │ SBOM_CYCLONEDX_JSON │
82+
│ Set │ No │
83+
│ Required │ No │
84+
├──────────┼────────────────────────┤
85+
│ Name │ vulnerabilities-report │
86+
│ Type │ SARIF │
87+
│ Set │ No │
88+
│ Required │ No │
89+
└──────────┴────────────────────────┘
5590
```
91+
We can see how the contract expects a container image, an SBOM, and a vulnerability report. We can also see that the SBOM is not required and neither the vulnerability report, but the container image is.
5692

57-
Once attestation is initiated, we can start [adding materials](/getting-started/attestation-crafting#adding-materials) to it.
58-
In this case we are adding an OCI container image.
93+
Once attestation is initiated, we can start [adding materials](/getting-started/attestation-crafting#adding-materials) to it.
94+
In this case we are adding an OCI container image, SBOM, and a vulnerability report.
5995
Many other material types are supported, check the [updated the list](/reference/operator/contract#material-schema)
6096

6197
```bash
62-
chainloop att add --value ghcr.io/chainloop-dev/chainloop/control-plane:latest
98+
chainloop att add --name container --value ghcr.io/chainloop-dev/chainloop/control-plane:latest
6399
```
64100

65-
We just attested the latest version of the control-plane image as an example, remember that you can provide any material you want to attest by pointing to a local filepath too, like for example
101+
We just attested the latest version of the control-plane image as an example, remember that you can provide any material you want to attest by pointing to a local filepath or URL too, like for example
66102

67103
```bash
68-
chainloop att add --value my-sbom.json
104+
chainloop att add --name sbom --value https://raw.githubusercontent.com/chainloop-dev/chainloop/refs/heads/main/docs/examples/quickstart/sbom.json
69105
```
70106

71-
:::info
72-
The piece of evidence kind were automatically detected, learn more about auto-discover [here](reference/attestations.md).
73-
:::
107+
And finally, we can add a vulnerability report:
74108

75-
And finally [we sign and push the attestation](/getting-started/attestation-crafting#encode-sign-and-push-attestation) to Chainloop for permanent preservation.
109+
```bash
110+
chainloop att add --name vulnerabilities-report --value https://raw.githubusercontent.com/chainloop-dev/chainloop/refs/heads/main/docs/examples/quickstart/vulnerabilities-report.json
111+
```
112+
113+
Once all the materials are pushed we can finally [sign and push the attestation](/getting-started/attestation-crafting#encode-sign-and-push-attestation) to Chainloop for permanent preservation.
76114

77115
```bash
78116
chainloop att push
79117
```
80118

119+
Transparently, Chainloop has signed the attestation and pushed it to the Chainloop Control Plane. You can learn more about the different [signing and verification methods](/reference/signing) in the Chainloop documentation.
120+
81121
6. Operate on your data:
82122

83123
At this point, we've performed our first attestation, now we can just play with the Chainloop CLI to inspect the attestation, verify it and so on.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This is an example contract that expects all containers to have a valid SBOM
2+
# and all artifacts to be signed. It also checks that the vulnerabilities
3+
# reports do not contain any vulnerabilities with severity higher than MEDIUM
4+
schemaVersion: v1
5+
materials:
6+
- name: container
7+
type: CONTAINER_IMAGE
8+
- name: sbom
9+
type: SBOM_CYCLONEDX_JSON
10+
optional: true
11+
- name: vulnerabilities-report
12+
type: SARIF
13+
optional: true
14+
policies:
15+
attestation:
16+
# Container with sbom checks that all containers added to the attestation
17+
# have a valid SBOM also present in the attestation
18+
- ref: containers-with-sbom
19+
materials:
20+
# Artifact signed checks that all artifacts such as Container Images and Charts are signed
21+
- ref: artifact-signed
22+
# Vulnerabilities checks the vulnerabilities reports if present in the attestation
23+
# does not contain any vulnerabilities with severity higher than the specified
24+
- ref: vulnerabilities
25+
with:
26+
severity: "MEDIUM"
27+
policyGroups:
28+
# This policy group applies a number of SBOM-related policies
29+
- ref: sbom-quality

docs/examples/quickstart/sbom.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.1.0",
3+
"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
4+
"runs": [
5+
{
6+
"tool": {
7+
"driver": {
8+
"name": "grype",
9+
"version": "0.87.0",
10+
"informationUri": "https://github.com/anchore/grype"
11+
}
12+
},
13+
"results": []
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)