Skip to content

Commit 81467a6

Browse files
committed
Use cluster issuer as default builder id
This is probably the most "correct" value for this field - it should uniquely identify the cluster, and will match other signature data included in Fulcio certs, etc. This is technically a breaking change, but likely one worth making. Users can still override this behavior with the config map as before. If omitted, this field is not populated as an indication that we don't know how to accurately identify this cluster.
1 parent dd3620e commit 81467a6

File tree

8 files changed

+306
-28
lines changed

8 files changed

+306
-28
lines changed

docs/config.md

Lines changed: 67 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
<!--
2-
---
3-
linkTitle: "Chains Configuration"
4-
weight: 20
1+
## <!--
2+
3+
linkTitle: "Chains Configuration" weight: 20
4+
55
---
6+
67
-->
78

89
# Chains Configuration
910

10-
`Chains` works by observing `TaskRun` and `PipelineRun` executions, capturing relevant information, and storing it in a cryptographically-signed format.
11+
`Chains` works by observing `TaskRun` and `PipelineRun` executions, capturing
12+
relevant information, and storing it in a cryptographically-signed format.
1113

12-
`TaskRuns` and `PipelineRuns` can indicate inputs and outputs which are then captured and surfaced in the `Chains` payload formats, where relevant.
13-
`Chains` uses the `Results` to _hint_ at the correct inputs and outputs. Check out [slsa-provenance.md](slsa-provenance.md) for more details.
14+
`TaskRuns` and `PipelineRuns` can indicate inputs and outputs which are then
15+
captured and surfaced in the `Chains` payload formats, where relevant. `Chains`
16+
uses the `Results` to _hint_ at the correct inputs and outputs. Check out
17+
[slsa-provenance.md](slsa-provenance.md) for more details.
1418

1519
## Chains Configuration
1620

17-
Chains uses a `ConfigMap` called `chains-config` in the `tekton-chains` namespace for configuration.
18-
Supported keys include:
21+
Chains uses a `ConfigMap` called `chains-config` in the `tekton-chains`
22+
namespace for configuration. Supported keys include:
1923

2024
### TaskRun Configuration
2125

@@ -41,7 +45,8 @@ Supported keys include:
4145

4246
> NOTE:
4347
>
44-
> - For grafeas storage backend, currently we only support Container Analysis. We will make grafeas server address configurabe within a short time.
48+
> - For grafeas storage backend, currently we only support Container Analysis.
49+
> We will make grafeas server address configurabe within a short time.
4550
> - `slsa/v1` is an alias of `in-toto` for backwards compatibility.
4651
> - `slsa/v2alpha2` corresponds to the slsav1.0 spec.
4752
@@ -72,34 +77,71 @@ Supported keys include:
7277

7378
#### docstore
7479

75-
You can read about the go-cloud docstore URI format [here](https://gocloud.dev/howto/docstore/). Tekton Chains supports the following docstore services:
80+
You can read about the go-cloud docstore URI format
81+
[here](https://gocloud.dev/howto/docstore/). Tekton Chains supports the
82+
following docstore services:
7683

7784
- `firestore`
7885
- `dynamodb`
7986
- `mongo`
8087

8188
#### MongoDB
8289

83-
With MongoDB you will need to add a `MONGO_SERVER_URL` env var with the MongoDB connection URI to the `tekton-chains-controller`, the go-cloud URI is just to point at the db and collection
90+
With MongoDB you will need to add a `MONGO_SERVER_URL` env var with the MongoDB
91+
connection URI to the `tekton-chains-controller`, the go-cloud URI is just to
92+
point at the db and collection
8493

8594
#### Grafeas
8695

87-
You can read more about Grafeas notes and occurrences [here](https://github.com/grafeas/grafeas/blob/master/docs/grafeas_concepts.md). To create occurrences, we have to create notes first that are used to link occurrences. Two types of occurrences will be created: `ATTESTATION` Occurrence and `BUILD` Occrrence. The configurable `noteid` is used as the prefix of the note name. Under the hood, the suffix `-simplesigning` will be appended for the `ATTESTATION` note, and the suffix `-intoto` will be appended for the `BUILD` note. If the `noteid` field is not configured, `tekton-<NAMESPACE>` will be used as the prefix.
96+
You can read more about Grafeas notes and occurrences
97+
[here](https://github.com/grafeas/grafeas/blob/master/docs/grafeas_concepts.md).
98+
To create occurrences, we have to create notes first that are used to link
99+
occurrences. Two types of occurrences will be created: `ATTESTATION` Occurrence
100+
and `BUILD` Occrrence. The configurable `noteid` is used as the prefix of the
101+
note name. Under the hood, the suffix `-simplesigning` will be appended for the
102+
`ATTESTATION` note, and the suffix `-intoto` will be appended for the `BUILD`
103+
note. If the `noteid` field is not configured, `tekton-<NAMESPACE>` will be used
104+
as the prefix.
88105

89106
### In-toto Configuration
90107

91-
| Key | Description | Supported Values | Default |
92-
| :-------------------------- | :--------------------------------------------- | :------------------------------------------------------------------------------ | :---------------------------------- |
93-
| `builder.id` | The builder ID to set for in-toto attestations | | `https://tekton.dev/chains/v2` |
94-
| `builddefinition.buildtype` | The buildType for in-toto attestations | `https://tekton.dev/chains/v2/slsa`, `https://tekton.dev/chains/v2/slsa-tekton` | `https://tekton.dev/chains/v2/slsa` |
108+
| Key | Description | Supported Values | Default |
109+
| :-------------------------- | :--------------------------------------------- | :------------------------------------------------------------------------------ | :----------------------------------- |
110+
| `builder.id` | The builder ID to set for in-toto attestations | | [Cluster's OIDC Issuer](#builder-id) |
111+
| `builddefinition.buildtype` | The buildType for in-toto attestations | `https://tekton.dev/chains/v2/slsa`, `https://tekton.dev/chains/v2/slsa-tekton` | `https://tekton.dev/chains/v2/slsa` |
95112

96-
> NOTE:
97-
> Considerations for the builddefinition.buildtype parameter:
113+
> NOTE: Considerations for the builddefinition.buildtype parameter:
98114
>
99-
> - It is only valid for `slsa/v2alpha2` configurations (see TaskRun or PipelineRun configuration).
115+
> - It is only valid for `slsa/v2alpha2` configurations (see TaskRun or
116+
> PipelineRun configuration).
100117
> - The parameter can take one of two values:
101-
> - `https://tekton.dev/chains/v2/slsa`: This buildType strictly conforms to the slsav1.0 spec.
102-
> - `https://tekton.dev/chains/v2/slsa-tekton`: This buildType also conforms to the slsav1.0 spec, but adds additional informaton specific to Tekton. This information includes the PipelinRun/TaskRun labels and annotations as internalParameters. It also includes capturing each pipeline task in a PipelinRun under resolvedDependencies.
118+
> - `https://tekton.dev/chains/v2/slsa`: This buildType strictly conforms to
119+
> the slsav1.0 spec.
120+
> - `https://tekton.dev/chains/v2/slsa-tekton`: This buildType also conforms
121+
> to the slsav1.0 spec, but adds additional informaton specific to Tekton.
122+
> This information includes the PipelinRun/TaskRun labels and annotations as
123+
> internalParameters. It also includes capturing each pipeline task in a
124+
> PipelinRun under resolvedDependencies.
125+
126+
#### Builder ID
127+
128+
By default, Tekton Chains uses the Cluster OIDC issuer as the Builder ID to
129+
identify the cluster performing the build.
130+
131+
This can vary depending on how the cluster is deployed - see
132+
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#serviceaccount-token-volume-projection
133+
for more details.
134+
135+
Examples:
136+
137+
- GKE:
138+
`https://containers.googleapis.com/v1/projects/123456789012/locations/us-east1/clusters/cluster-1`
139+
- EKS:
140+
`https://oidc.eks.us-east-1.amazonaws.com/id/12345678901234567890123456789012`
141+
- AKS:
142+
`https://eastus.oic.prod-aks.azure.com/00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000/`
143+
- Kind/Local: `https://kubernetes.default.svc` (NOTE: this isn't a real URL and
144+
won't give you much useful information)
103145

104146
### Sigstore Features Configuration
105147

@@ -110,7 +152,9 @@ You can read more about Grafeas notes and occurrences [here](https://github.com/
110152
| `transparency.enabled` | Whether to enable automatic binary transparency uploads. | `true`, `false`, `manual` | `false` |
111153
| `transparency.url` | The URL to upload binary transparency attestations to, if enabled. | | `https://rekor.sigstore.dev` |
112154

113-
**Note**: If `transparency.enabled` is set to `manual`, then only `TaskRuns` and `PipelineRuns` with the following annotation will be uploaded to the transparency log:
155+
**Note**: If `transparency.enabled` is set to `manual`, then only `TaskRuns` and
156+
`PipelineRuns` with the following annotation will be uploaded to the
157+
transparency log:
114158

115159
```yaml
116160
chains.tekton.dev/transparency-upload: "true"

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
module github.com/tektoncd/chains
22

3-
go 1.20
3+
go 1.21
4+
5+
toolchain go1.21.2
46

57
require (
68
cloud.google.com/go/compute/metadata v0.2.3
79
cloud.google.com/go/storage v1.35.1
10+
github.com/golang-jwt/jwt/v5 v5.0.0
811
github.com/golangci/golangci-lint v1.55.2
912
github.com/google/addlicense v1.1.1
1013
github.com/google/go-cmp v0.6.0
@@ -33,6 +36,7 @@ require (
3336
gocloud.dev/docstore/mongodocstore v0.34.0
3437
gocloud.dev/pubsub/kafkapubsub v0.34.0
3538
golang.org/x/crypto v0.15.0
39+
golang.org/x/oauth2 v0.13.0
3640
google.golang.org/grpc v1.59.0
3741
google.golang.org/protobuf v1.31.0
3842
k8s.io/api v0.28.3
@@ -220,7 +224,6 @@ require (
220224
github.com/gofrs/flock v0.8.1 // indirect
221225
github.com/gogo/protobuf v1.3.2 // indirect
222226
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
223-
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
224227
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
225228
github.com/golang/protobuf v1.5.3 // indirect
226229
github.com/golang/snappy v0.0.4 // indirect
@@ -440,7 +443,6 @@ require (
440443
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
441444
golang.org/x/mod v0.13.0 // indirect
442445
golang.org/x/net v0.17.0 // indirect
443-
golang.org/x/oauth2 v0.13.0 // indirect
444446
golang.org/x/sync v0.5.0 // indirect
445447
golang.org/x/sys v0.14.0 // indirect
446448
golang.org/x/term v0.14.0 // indirect

0 commit comments

Comments
 (0)