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