-
Notifications
You must be signed in to change notification settings - Fork 503
/
cip-requires-two-signatures-and-two-attestations.yaml
158 lines (156 loc) · 4.87 KB
/
cip-requires-two-signatures-and-two-attestations.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Copyright 2022 The Sigstore Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: cosigned.sigstore.dev/v1alpha1
kind: ClusterImagePolicy
metadata:
name: image-policy-requires-two-signatures-two-attestations
spec:
images:
- glob: registry.local:5000/cosigned/demo*
authorities:
- name: keyless-att
keyless:
url: http://fulcio.fulcio-system.svc
ctlog:
url: http://rekor.rekor-system.svc
attestations:
- predicateType: custom
name: custom-keyless
policy:
type: cue
data: |
import "time"
before: time.Parse(time.RFC3339, "2049-10-09T17:10:27Z")
predicateType: "cosign.sigstore.dev/attestation/v1"
predicate: {
Timestamp: <before
}
- predicateType: vuln
name: vuln-keyless
policy:
type: cue
data: |
import "time"
before: time.Parse(time.RFC3339, "2022-04-15T17:10:27Z")
after: time.Parse(time.RFC3339, "2022-03-09T17:10:27Z")
predicateType: "cosign.sigstore.dev/attestation/vuln/v1"
predicate: {
invocation: {
uri: "invocation.example.com/cosign-testing"
}
scanner: {
uri: "fakescanner.example.com/cosign-testing"
}
metadata: {
scanStartedOn: <before
scanStartedOn: >after
scanFinishedOn: <before
scanFinishedOn: >after
}
}
- name: key-att
key:
data: |
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEOz9FcbJM/oOkC26Wfo9paG2tYGBL
usDLHze93DzgLaAPDsyJrygpVnL9M6SOyfyXEsjpBTUu6uFZqHua8hwAlA==
-----END PUBLIC KEY-----
attestations:
- predicateType: vuln
name: vuln-key
policy:
type: cue
data: |
import "time"
before: time.Parse(time.RFC3339, "2022-04-15T17:10:27Z")
after: time.Parse(time.RFC3339, "2022-03-09T17:10:27Z")
predicateType: "cosign.sigstore.dev/attestation/vuln/v1"
predicate: {
invocation: {
uri: "invocation.example.com/cosign-testing"
}
scanner: {
uri: "fakescanner.example.com/cosign-testing"
}
metadata: {
scanStartedOn: <before
scanStartedOn: >after
scanFinishedOn: <before
scanFinishedOn: >after
}
}
ctlog:
url: http://rekor.rekor-system.svc
- name: keyless-signature
keyless:
url: http://fulcio.fulcio-system.svc
ctlog:
url: http://rekor.rekor-system.svc
- name: key-signature
key:
data: |
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEOz9FcbJM/oOkC26Wfo9paG2tYGBL
usDLHze93DzgLaAPDsyJrygpVnL9M6SOyfyXEsjpBTUu6uFZqHua8hwAlA==
-----END PUBLIC KEY-----
ctlog:
url: http://rekor.rekor-system.svc
policy:
type: cue
data: |
if len(authorityMatches."keyless-att".attestations) < 2 {
keylessAttestationsErr: 1
keylessAttestationsErrMsg: "Did not get both keyless attestations"
}
if len(authorityMatches."key-att".attestations) < 1 {
keyAttestationsErr: 1
keyAttestationsErrMsg: "Did not get key attestation"
}
if len(authorityMatches."keyless-signature".signatures) < 1 {
keylessSignatureErr: 1
keylessSignatureErrMsg: "Did not get keyless signature"
}
if len(authorityMatches."key-signature".signatures) < 1 {
keySignatureErr: 1
keySignatureErrMsg: "Did not get key signature"
}
authorityMatches: {
"key-att": {
attestations: {
"vuln-key": [
{subject: "PLACEHOLDER", issuer: "PLACEHOLDER"},
]
}
}
"keyless-att": {
attestations: {
"vuln-keyless": [
{subject: "PLACEHOLDER", issuer: "PLACEHOLDER"},
],
"custom-keyless": [
{subject: "PLACEHOLDER", issuer: "PLACEHOLDER"},
],
}
}
"keyless-signature": {
signatures: [
{subject: "PLACEHOLDER", issuer: "PLACEHOLDER"},
]
}
"key-signature": {
signatures: [
{subject: "PLACEHOLDER", issuer: "PLACEHOLDER"},
]
}
}