Skip to content

Commit 8566ce6

Browse files
feat: Updating the grafeas protos to include compliance and intoto attestation protos (#352)
* feat: Updating the grafeas protos to include compliance and intoto attestation protos PiperOrigin-RevId: 407119231 Source-Link: googleapis/googleapis@381ab78 Source-Link: googleapis/googleapis-gen@e90da8d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTkwZGE4ZGQ4MzEwNTM3YjUzMTMzZWZiMTg2N2E4OTkwYWRiMTQ5YSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent f0b7337 commit 8566ce6

16 files changed

+15668
-5265
lines changed

packages/google-devtools-containeranalysis/protos/grafeas/v1/attestation.proto

+17
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ message AttestationNote {
5353
Hint hint = 1;
5454
}
5555

56+
message Jwt {
57+
// The compact encoding of a JWS, which is always three base64 encoded strings
58+
// joined by periods. For details, see:
59+
// https://tools.ietf.org/html/rfc7515.html#section-3.1
60+
string compact_jwt = 1;
61+
}
62+
5663
// Occurrence that represents a single "attestation". The authenticity of an
5764
// attestation can be verified using the attached signature. If the verifier
5865
// trusts the public key of the signer, then verifying the signature is
@@ -70,4 +77,14 @@ message AttestationOccurrence {
7077
// `signature` verifies `serialized_payload`. See `Signature` in common.proto
7178
// for more details on signature structure and verification.
7279
repeated Signature signatures = 2;
80+
// One or more JWTs encoding a self-contained attestation.
81+
// Each JWT encodes the payload that it verifies within the JWT itself.
82+
// Verifier implementation SHOULD ignore the `serialized_payload` field
83+
// when verifying these JWTs.
84+
// If only JWTs are present on this AttestationOccurrence, then the
85+
// `serialized_payload` SHOULD be left empty.
86+
// Each JWT SHOULD encode a claim specific to the `resource_uri` of this
87+
// Occurrence, but this is not validated by Grafeas metadata API
88+
// implementations. The JWT itself is opaque to Grafeas.
89+
repeated Jwt jwts = 3;
7390
}

packages/google-devtools-containeranalysis/protos/grafeas/v1/build.proto

+13-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ syntax = "proto3";
1616

1717
package grafeas.v1;
1818

19+
import "grafeas/v1/intoto_provenance.proto";
20+
import "grafeas/v1/intoto_statement.proto";
1921
import "grafeas/v1/provenance.proto";
2022

2123
option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas";
@@ -32,7 +34,7 @@ message BuildNote {
3234

3335
// Details of a build occurrence.
3436
message BuildOccurrence {
35-
// Required. The actual provenance for the build.
37+
// The actual provenance for the build.
3638
grafeas.v1.BuildProvenance provenance = 1;
3739

3840
// Serialized JSON representation of the provenance, used in generating the
@@ -47,4 +49,14 @@ message BuildOccurrence {
4749
// provenance is marshalled to json as well to prevent incompatibilities with
4850
// future changes.
4951
string provenance_bytes = 2;
52+
53+
// Deprecated. See InTotoStatement for the replacement.
54+
// In-toto Provenance representation as defined in spec.
55+
InTotoProvenance intoto_provenance = 3;
56+
57+
// In-toto Statement representation as defined in spec.
58+
// The intoto_statement can contain any type of provenance. The serialized
59+
// payload of the statement can be stored and signed in the Occurrence's
60+
// envelope.
61+
InTotoStatement intoto_statement = 4;
5062
}

packages/google-devtools-containeranalysis/protos/grafeas/v1/common.proto

+20-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ option objc_class_prefix = "GRA";
2323

2424
// Kind represents the kinds of notes supported.
2525
enum NoteKind {
26-
// Unknown.
26+
// Default value. This value is unused.
2727
NOTE_KIND_UNSPECIFIED = 0;
2828
// The note and occurrence represent a package vulnerability.
2929
VULNERABILITY = 1;
@@ -41,6 +41,10 @@ enum NoteKind {
4141
ATTESTATION = 7;
4242
// This represents an available package upgrade.
4343
UPGRADE = 8;
44+
// This represents a Compliance Note
45+
COMPLIANCE = 9;
46+
// This represents a DSSE attestation Note
47+
DSSE_ATTESTATION = 10;
4448
}
4549

4650
// Metadata for any related URL information.
@@ -84,7 +88,7 @@ message Signature {
8488

8589
// The identifier for the public key that verifies this signature.
8690
// * The `public_key_id` is required.
87-
// * The `public_key_id` MUST be an RFC3986 conformant URI.
91+
// * The `public_key_id` SHOULD be an RFC3986 conformant URI.
8892
// * When possible, the `public_key_id` SHOULD be an immutable reference,
8993
// such as a cryptographic digest.
9094
//
@@ -101,3 +105,17 @@ message Signature {
101105
// * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5"
102106
string public_key_id = 2;
103107
}
108+
109+
// MUST match
110+
// https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto. An
111+
// authenticated message of arbitrary type.
112+
message Envelope {
113+
bytes payload = 1;
114+
string payload_type = 2;
115+
repeated EnvelopeSignature signatures = 3;
116+
}
117+
118+
message EnvelopeSignature {
119+
bytes sig = 1;
120+
string keyid = 2;
121+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright 2021 The Grafeas Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package grafeas.v1;
18+
19+
import "grafeas/v1/vulnerability.proto";
20+
21+
option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas";
22+
option java_multiple_files = true;
23+
option java_package = "io.grafeas.v1";
24+
option objc_class_prefix = "GRA";
25+
26+
message ComplianceNote {
27+
// The title that identifies this compliance check.
28+
string title = 1;
29+
// A description about this compliance check.
30+
string description = 2;
31+
// The OS and config versions the benchmark applies to.
32+
repeated grafeas.v1.ComplianceVersion version = 3;
33+
// A rationale for the existence of this compliance check.
34+
string rationale = 4;
35+
// A description of remediation steps if the compliance check fails.
36+
string remediation = 5;
37+
// A compliance check that is a CIS benchmark.
38+
message CisBenchmark {
39+
int32 profile_level = 1;
40+
grafeas.v1.Severity severity = 2;
41+
}
42+
oneof compliance_type {
43+
CisBenchmark cis_benchmark = 6;
44+
}
45+
// Serialized scan instructions with a predefined format.
46+
bytes scan_instructions = 7;
47+
}
48+
49+
// Describes the CIS benchmark version that is applicable to a given OS and
50+
// os version.
51+
message ComplianceVersion {
52+
// The CPE URI (https://cpe.mitre.org/specification/) this benchmark is
53+
// applicable to.
54+
string cpe_uri = 1;
55+
// The version of the benchmark. This is set to the version of the OS-specific
56+
// CIS document the benchmark is defined in.
57+
string version = 2;
58+
}
59+
60+
// An indication that the compliance checks in the associated ComplianceNote
61+
// were not satisfied for particular resources or a specified reason.
62+
message ComplianceOccurrence {
63+
repeated NonCompliantFile non_compliant_files = 2;
64+
string non_compliance_reason = 3;
65+
}
66+
67+
// Details about files that caused a compliance check to fail.
68+
message NonCompliantFile {
69+
// display_command is a single command that can be used to display a list of
70+
// non compliant files. When there is no such command, we can also iterate a
71+
// list of non compliant file using 'path'.
72+
73+
// Empty if `display_command` is set.
74+
string path = 1;
75+
// Command to display the non-compliant files.
76+
string display_command = 2;
77+
// Explains why a file is non compliant for a CIS check.
78+
string reason = 3;
79+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2021 The Grafeas Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
syntax = "proto3";
15+
16+
package grafeas.v1;
17+
18+
import "grafeas/v1/common.proto";
19+
import "grafeas/v1/intoto_statement.proto";
20+
21+
option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas";
22+
option java_multiple_files = true;
23+
option java_package = "io.grafeas.v1";
24+
option objc_class_prefix = "GRA";
25+
26+
message DSSEAttestationNote {
27+
// This submessage provides human-readable hints about the purpose of the
28+
// authority. Because the name of a note acts as its resource reference, it is
29+
// important to disambiguate the canonical name of the Note (which might be a
30+
// UUID for security purposes) from "readable" names more suitable for debug
31+
// output. Note that these hints should not be used to look up authorities in
32+
// security sensitive contexts, such as when looking up attestations to
33+
// verify.
34+
message DSSEHint {
35+
// Required. The human readable name of this attestation authority, for
36+
// example "cloudbuild-prod".
37+
string human_readable_name = 1;
38+
}
39+
// DSSEHint hints at the purpose of the attestation authority.
40+
DSSEHint hint = 1;
41+
}
42+
43+
// Deprecated. Prefer to use a regular Occurrence, and populate the
44+
// Envelope at the top level of the Occurrence.
45+
message DSSEAttestationOccurrence {
46+
// If doing something security critical, make sure to verify the signatures in
47+
// this metadata.
48+
Envelope envelope = 1;
49+
oneof decoded_payload {
50+
InTotoStatement statement = 2;
51+
}
52+
}

packages/google-devtools-containeranalysis/protos/grafeas/v1/grafeas.proto

+13
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ import "google/protobuf/timestamp.proto";
2626
import "grafeas/v1/attestation.proto";
2727
import "grafeas/v1/build.proto";
2828
import "grafeas/v1/common.proto";
29+
import "grafeas/v1/compliance.proto";
2930
import "grafeas/v1/deployment.proto";
3031
import "grafeas/v1/discovery.proto";
32+
import "grafeas/v1/dsse_attestation.proto";
3133
import "grafeas/v1/image.proto";
3234
import "grafeas/v1/package.proto";
3335
import "grafeas/v1/upgrade.proto";
@@ -242,7 +244,14 @@ message Occurrence {
242244
grafeas.v1.AttestationOccurrence attestation = 14;
243245
// Describes an available package upgrade on the linked resource.
244246
grafeas.v1.UpgradeOccurrence upgrade = 15;
247+
// Describes a compliance violation on a linked resource.
248+
grafeas.v1.ComplianceOccurrence compliance = 16;
249+
// Describes an attestation of an artifact using dsse.
250+
grafeas.v1.DSSEAttestationOccurrence dsse_attestation = 17;
245251
}
252+
253+
// https://github.com/secure-systems-lab/dsse
254+
grafeas.v1.Envelope envelope = 18;
246255
}
247256

248257
// A type of analysis that can be done for a resource.
@@ -301,6 +310,10 @@ message Note {
301310
grafeas.v1.AttestationNote attestation = 16;
302311
// A note describing available package upgrades.
303312
grafeas.v1.UpgradeNote upgrade = 17;
313+
// A note describing a compliance check.
314+
grafeas.v1.ComplianceNote compliance = 18;
315+
// A note describing a dsse attestation note.
316+
grafeas.v1.DSSEAttestationNote dsse_attestation = 19;
304317
}
305318
}
306319

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
// Copyright 2021 The Grafeas Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package grafeas.v1;
18+
19+
import "google/protobuf/any.proto";
20+
import "google/protobuf/timestamp.proto";
21+
22+
option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas";
23+
option java_multiple_files = true;
24+
option java_package = "io.grafeas.v1";
25+
option objc_class_prefix = "GRA";
26+
27+
// Spec defined at
28+
// https://github.com/in-toto/attestation/blob/main/spec/predicates/provenance.md
29+
30+
// Steps taken to build the artifact.
31+
// For a TaskRun, typically each container corresponds to one step in the
32+
// recipe.
33+
message Recipe {
34+
// URI indicating what type of recipe was performed. It determines the meaning
35+
// of recipe.entryPoint, recipe.arguments, recipe.environment, and materials.
36+
string type = 1;
37+
// Index in materials containing the recipe steps that are not implied by
38+
// recipe.type. For example, if the recipe type were "make", then this would
39+
// point to the source containing the Makefile, not the make program itself.
40+
// Set to -1 if the recipe doesn't come from a material, as zero is default
41+
// unset value for int64.
42+
int64 defined_in_material = 2;
43+
// String identifying the entry point into the build.
44+
// This is often a path to a configuration file and/or a target label within
45+
// that file. The syntax and meaning are defined by recipe.type. For example,
46+
// if the recipe type were "make", then this would reference the directory in
47+
// which to run make as well as which target to use.
48+
string entry_point = 3;
49+
// Collection of all external inputs that influenced the build on top of
50+
// recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe
51+
// type were "make", then this might be the flags passed to make aside from
52+
// the target, which is captured in recipe.entryPoint. Since the arguments
53+
// field can greatly vary in structure, depending on the builder and recipe
54+
// type, this is of form "Any".
55+
repeated google.protobuf.Any arguments = 4;
56+
// Any other builder-controlled inputs necessary for correctly evaluating the
57+
// recipe. Usually only needed for reproducing the build but not evaluated as
58+
// part of policy. Since the environment field can greatly vary in structure,
59+
// depending on the builder and recipe type, this is of form "Any".
60+
repeated google.protobuf.Any environment = 5;
61+
}
62+
63+
// Indicates that the builder claims certain fields in this message to be
64+
// complete.
65+
message Completeness {
66+
// If true, the builder claims that recipe.arguments is complete, meaning that
67+
// all external inputs are properly captured in the recipe.
68+
bool arguments = 1;
69+
// If true, the builder claims that recipe.environment is claimed to be
70+
// complete.
71+
bool environment = 2;
72+
// If true, the builder claims that materials are complete, usually through
73+
// some controls to prevent network access. Sometimes called "hermetic".
74+
bool materials = 3;
75+
}
76+
77+
// Other properties of the build.
78+
message Metadata {
79+
// Identifies the particular build invocation, which can be useful for finding
80+
// associated logs or other ad-hoc analysis. The value SHOULD be globally
81+
// unique, per in-toto Provenance spec.
82+
string build_invocation_id = 1;
83+
// The timestamp of when the build started.
84+
google.protobuf.Timestamp build_started_on = 2;
85+
// The timestamp of when the build completed.
86+
google.protobuf.Timestamp build_finished_on = 3;
87+
// Indicates that the builder claims certain fields in this message to be
88+
// complete.
89+
Completeness completeness = 4;
90+
// If true, the builder claims that running the recipe on materials will
91+
// produce bit-for-bit identical output.
92+
bool reproducible = 5;
93+
}
94+
95+
message BuilderConfig {
96+
string id = 1;
97+
}
98+
99+
message InTotoProvenance {
100+
BuilderConfig builder_config = 1; // required
101+
// Identifies the configuration used for the build.
102+
// When combined with materials, this SHOULD fully describe the build,
103+
// such that re-running this recipe results in bit-for-bit identical output
104+
// (if the build is reproducible).
105+
Recipe recipe = 2; // required
106+
Metadata metadata = 3;
107+
// The collection of artifacts that influenced the build including sources,
108+
// dependencies, build tools, base images, and so on. This is considered to be
109+
// incomplete unless metadata.completeness.materials is true. Unset or null is
110+
// equivalent to empty.
111+
repeated string materials = 4;
112+
}

0 commit comments

Comments
 (0)