grafeas 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +11 -0
  3. data/AUTHENTICATION.md +199 -0
  4. data/LICENSE +201 -0
  5. data/README.md +55 -25
  6. data/lib/grafeas.rb +151 -2
  7. data/lib/grafeas/v1.rb +155 -0
  8. data/lib/grafeas/v1/attestation_pb.rb +27 -0
  9. data/lib/grafeas/v1/build_pb.rb +23 -0
  10. data/lib/grafeas/v1/common_pb.rb +34 -0
  11. data/lib/grafeas/v1/credentials.rb +37 -0
  12. data/lib/grafeas/v1/cvss_pb.rb +67 -0
  13. data/lib/grafeas/v1/deployment_pb.rb +35 -0
  14. data/lib/grafeas/v1/discovery_pb.rb +40 -0
  15. data/lib/grafeas/v1/doc/google/protobuf/any.rb +131 -0
  16. data/lib/grafeas/v1/doc/google/protobuf/empty.rb +29 -0
  17. data/lib/grafeas/v1/doc/google/protobuf/field_mask.rb +222 -0
  18. data/lib/grafeas/v1/doc/google/protobuf/timestamp.rb +113 -0
  19. data/lib/grafeas/v1/doc/google/rpc/status.rb +87 -0
  20. data/lib/grafeas/v1/doc/grafeas/v1/attestation.rb +64 -0
  21. data/lib/grafeas/v1/doc/grafeas/v1/build.rb +44 -0
  22. data/lib/grafeas/v1/doc/grafeas/v1/common.rb +105 -0
  23. data/lib/grafeas/v1/doc/grafeas/v1/cvss.rb +104 -0
  24. data/lib/grafeas/v1/doc/grafeas/v1/deployment.rb +64 -0
  25. data/lib/grafeas/v1/doc/grafeas/v1/discovery.rb +76 -0
  26. data/lib/grafeas/v1/doc/grafeas/v1/grafeas.rb +322 -0
  27. data/lib/grafeas/v1/doc/grafeas/v1/image.rb +79 -0
  28. data/lib/grafeas/v1/doc/grafeas/v1/package.rb +125 -0
  29. data/lib/grafeas/v1/doc/grafeas/v1/provenance.rb +248 -0
  30. data/lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb +214 -0
  31. data/lib/grafeas/v1/grafeas_client.rb +961 -0
  32. data/lib/grafeas/v1/grafeas_client_config.json +96 -0
  33. data/lib/grafeas/v1/grafeas_pb.rb +163 -0
  34. data/lib/grafeas/v1/grafeas_services_pb.rb +86 -0
  35. data/lib/grafeas/v1/image_pb.rb +36 -0
  36. data/lib/grafeas/v1/package_pb.rb +59 -0
  37. data/lib/grafeas/v1/provenance_pb.rb +116 -0
  38. data/lib/grafeas/v1/vulnerability_pb.rb +81 -0
  39. data/lib/grafeas/version.rb +16 -1
  40. metadata +111 -31
  41. data/.gitignore +0 -8
  42. data/.travis.yml +0 -5
  43. data/Gemfile +0 -6
  44. data/Gemfile.lock +0 -22
  45. data/LICENSE.txt +0 -21
  46. data/Rakefile +0 -10
  47. data/bin/console +0 -14
  48. data/bin/setup +0 -8
  49. data/grafeas.gemspec +0 -26
@@ -0,0 +1,79 @@
1
+ # Copyright 2019 Google LLC
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
+ # https://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
+
16
+ module Grafeas
17
+ module V1
18
+ # Layer holds metadata specific to a layer of a Docker image.
19
+ # @!attribute [rw] directive
20
+ # @return [String]
21
+ # Required. The recovered Dockerfile directive used to construct this layer.
22
+ # See https://docs.docker.com/engine/reference/builder/ for more information.
23
+ # @!attribute [rw] arguments
24
+ # @return [String]
25
+ # The recovered arguments to the Dockerfile directive.
26
+ class Layer; end
27
+
28
+ # A set of properties that uniquely identify a given Docker image.
29
+ # @!attribute [rw] v1_name
30
+ # @return [String]
31
+ # Required. The layer ID of the final layer in the Docker image's v1
32
+ # representation.
33
+ # @!attribute [rw] v2_blob
34
+ # @return [Array<String>]
35
+ # Required. The ordered list of v2 blobs that represent a given image.
36
+ # @!attribute [rw] v2_name
37
+ # @return [String]
38
+ # Output only. The name of the image's v2 blobs computed via:
39
+ # [bottom] := v2_blob[bottom]
40
+ # [N] := sha256(v2_blob[N] + " " + v2_name[N+1])
41
+ # Only the name of the final blob is kept.
42
+ class Fingerprint; end
43
+
44
+ # Basis describes the base image portion (Note) of the DockerImage
45
+ # relationship. Linked occurrences are derived from this or an equivalent image
46
+ # via:
47
+ # FROM <Basis.resource_url>
48
+ # Or an equivalent reference, e.g., a tag of the resource_url.
49
+ # @!attribute [rw] resource_url
50
+ # @return [String]
51
+ # Required. Immutable. The resource_url for the resource representing the
52
+ # basis of associated occurrence images.
53
+ # @!attribute [rw] fingerprint
54
+ # @return [Grafeas::V1::Fingerprint]
55
+ # Required. Immutable. The fingerprint of the base image.
56
+ class ImageNote; end
57
+
58
+ # Details of the derived image portion of the DockerImage relationship. This
59
+ # image would be produced from a Dockerfile with FROM <DockerImage.Basis in
60
+ # attached Note>.
61
+ # @!attribute [rw] fingerprint
62
+ # @return [Grafeas::V1::Fingerprint]
63
+ # Required. The fingerprint of the derived image.
64
+ # @!attribute [rw] distance
65
+ # @return [Integer]
66
+ # Output only. The number of layers by which this image differs from the
67
+ # associated image basis.
68
+ # @!attribute [rw] layer_info
69
+ # @return [Array<Grafeas::V1::Layer>]
70
+ # This contains layer-specific metadata, if populated it has length
71
+ # "distance" and is ordered with [distance] being the layer immediately
72
+ # following the base image and [1] being the final layer.
73
+ # @!attribute [rw] base_resource_url
74
+ # @return [String]
75
+ # Output only. This contains the base image URL for the derived image
76
+ # occurrence.
77
+ class ImageOccurrence; end
78
+ end
79
+ end
@@ -0,0 +1,125 @@
1
+ # Copyright 2019 Google LLC
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
+ # https://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
+
16
+ module Grafeas
17
+ module V1
18
+ # This represents a particular channel of distribution for a given package.
19
+ # E.g., Debian's jessie-backports dpkg mirror.
20
+ # @!attribute [rw] cpe_uri
21
+ # @return [String]
22
+ # Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
23
+ # denoting the package manager version distributing a package.
24
+ # @!attribute [rw] architecture
25
+ # @return [Grafeas::V1::Architecture]
26
+ # The CPU architecture for which packages in this distribution channel were
27
+ # built.
28
+ # @!attribute [rw] latest_version
29
+ # @return [Grafeas::V1::Version]
30
+ # The latest available version of this package in this distribution channel.
31
+ # @!attribute [rw] maintainer
32
+ # @return [String]
33
+ # A freeform string denoting the maintainer of this package.
34
+ # @!attribute [rw] url
35
+ # @return [String]
36
+ # The distribution channel-specific homepage for this package.
37
+ # @!attribute [rw] description
38
+ # @return [String]
39
+ # The distribution channel-specific description of this package.
40
+ class Distribution; end
41
+
42
+ # An occurrence of a particular package installation found within a system's
43
+ # filesystem. E.g., glibc was found in `/var/lib/dpkg/status`.
44
+ # @!attribute [rw] cpe_uri
45
+ # @return [String]
46
+ # Required. The CPE URI in [CPE format](https://cpe.mitre.org/specification/)
47
+ # denoting the package manager version distributing a package.
48
+ # @!attribute [rw] version
49
+ # @return [Grafeas::V1::Version]
50
+ # The version installed at this location.
51
+ # @!attribute [rw] path
52
+ # @return [String]
53
+ # The path from which we gathered that this package/version is installed.
54
+ class Location; end
55
+
56
+ # This represents a particular package that is distributed over various
57
+ # channels. E.g., glibc (aka libc6) is distributed by many, at various
58
+ # versions.
59
+ # @!attribute [rw] name
60
+ # @return [String]
61
+ # Required. Immutable. The name of the package.
62
+ # @!attribute [rw] distribution
63
+ # @return [Array<Grafeas::V1::Distribution>]
64
+ # The various channels by which a package is distributed.
65
+ class PackageNote; end
66
+
67
+ # Details on how a particular software package was installed on a system.
68
+ # @!attribute [rw] name
69
+ # @return [String]
70
+ # Output only. The name of the installed package.
71
+ # @!attribute [rw] location
72
+ # @return [Array<Grafeas::V1::Location>]
73
+ # Required. All of the places within the filesystem versions of this package
74
+ # have been found.
75
+ class PackageOccurrence; end
76
+
77
+ # Version contains structured information about the version of a package.
78
+ # @!attribute [rw] epoch
79
+ # @return [Integer]
80
+ # Used to correct mistakes in the version numbering scheme.
81
+ # @!attribute [rw] name
82
+ # @return [String]
83
+ # Required only when version kind is NORMAL. The main part of the version
84
+ # name.
85
+ # @!attribute [rw] revision
86
+ # @return [String]
87
+ # The iteration of the package build from the above version.
88
+ # @!attribute [rw] kind
89
+ # @return [Grafeas::V1::Version::VersionKind]
90
+ # Required. Distinguishes between sentinel MIN/MAX versions and normal
91
+ # versions.
92
+ # @!attribute [rw] full_name
93
+ # @return [String]
94
+ # Human readable version string. This string is of the form
95
+ # <epoch>:<name>-<revision> and is only set when kind is NORMAL.
96
+ class Version
97
+ # Whether this is an ordinary package version or a sentinel MIN/MAX version.
98
+ module VersionKind
99
+ # Unknown.
100
+ VERSION_KIND_UNSPECIFIED = 0
101
+
102
+ # A standard package version.
103
+ NORMAL = 1
104
+
105
+ # A special version representing negative infinity.
106
+ MINIMUM = 2
107
+
108
+ # A special version representing positive infinity.
109
+ MAXIMUM = 3
110
+ end
111
+ end
112
+
113
+ # Instruction set architectures supported by various package managers.
114
+ module Architecture
115
+ # Unknown architecture.
116
+ ARCHITECTURE_UNSPECIFIED = 0
117
+
118
+ # X86 architecture.
119
+ X86 = 1
120
+
121
+ # X64 architecture.
122
+ X64 = 2
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,248 @@
1
+ # Copyright 2019 Google LLC
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
+ # https://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
+
16
+ module Grafeas
17
+ module V1
18
+ # Provenance of a build. Contains all information needed to verify the full
19
+ # details about the build from source to completion.
20
+ # @!attribute [rw] id
21
+ # @return [String]
22
+ # Required. Unique identifier of the build.
23
+ # @!attribute [rw] project_id
24
+ # @return [String]
25
+ # ID of the project.
26
+ # @!attribute [rw] commands
27
+ # @return [Array<Grafeas::V1::Command>]
28
+ # Commands requested by the build.
29
+ # @!attribute [rw] built_artifacts
30
+ # @return [Array<Grafeas::V1::Artifact>]
31
+ # Output of the build.
32
+ # @!attribute [rw] create_time
33
+ # @return [Google::Protobuf::Timestamp]
34
+ # Time at which the build was created.
35
+ # @!attribute [rw] start_time
36
+ # @return [Google::Protobuf::Timestamp]
37
+ # Time at which execution of the build was started.
38
+ # @!attribute [rw] end_time
39
+ # @return [Google::Protobuf::Timestamp]
40
+ # Time at which execution of the build was finished.
41
+ # @!attribute [rw] creator
42
+ # @return [String]
43
+ # E-mail address of the user who initiated this build. Note that this was the
44
+ # user's e-mail address at the time the build was initiated; this address may
45
+ # not represent the same end-user for all time.
46
+ # @!attribute [rw] logs_uri
47
+ # @return [String]
48
+ # URI where any logs for this provenance were written.
49
+ # @!attribute [rw] source_provenance
50
+ # @return [Grafeas::V1::Source]
51
+ # Details of the Source input to the build.
52
+ # @!attribute [rw] trigger_id
53
+ # @return [String]
54
+ # Trigger identifier if the build was triggered automatically; empty if not.
55
+ # @!attribute [rw] build_options
56
+ # @return [Hash{String => String}]
57
+ # Special options applied to this build. This is a catch-all field where
58
+ # build providers can enter any desired additional details.
59
+ # @!attribute [rw] builder_version
60
+ # @return [String]
61
+ # Version string of the builder at the time this build was executed.
62
+ class BuildProvenance; end
63
+
64
+ # Source describes the location of the source used for the build.
65
+ # @!attribute [rw] artifact_storage_source_uri
66
+ # @return [String]
67
+ # If provided, the input binary artifacts for the build came from this
68
+ # location.
69
+ # @!attribute [rw] file_hashes
70
+ # @return [Hash{String => Grafeas::V1::FileHashes}]
71
+ # Hash(es) of the build source, which can be used to verify that the original
72
+ # source integrity was maintained in the build.
73
+ #
74
+ # The keys to this map are file paths used as build source and the values
75
+ # contain the hash values for those files.
76
+ #
77
+ # If the build source came in a single package such as a gzipped tarfile
78
+ # (.tar.gz), the FileHash will be for the single path to that file.
79
+ # @!attribute [rw] context
80
+ # @return [Grafeas::V1::SourceContext]
81
+ # If provided, the source code used for the build came from this location.
82
+ # @!attribute [rw] additional_contexts
83
+ # @return [Array<Grafeas::V1::SourceContext>]
84
+ # If provided, some of the source code used for the build may be found in
85
+ # these locations, in the case where the source repository had multiple
86
+ # remotes or submodules. This list will not include the context specified in
87
+ # the context field.
88
+ class Source; end
89
+
90
+ # Container message for hashes of byte content of files, used in source
91
+ # messages to verify integrity of source input to the build.
92
+ # @!attribute [rw] file_hash
93
+ # @return [Array<Grafeas::V1::Hash>]
94
+ # Required. Collection of file hashes.
95
+ class FileHashes; end
96
+
97
+ # Container message for hash values.
98
+ # @!attribute [rw] type
99
+ # @return [String]
100
+ # Required. The type of hash that was performed, e.g. "SHA-256".
101
+ # @!attribute [rw] value
102
+ # @return [String]
103
+ # Required. The hash value.
104
+ class Hash; end
105
+
106
+ # Command describes a step performed as part of the build pipeline.
107
+ # @!attribute [rw] name
108
+ # @return [String]
109
+ # Required. Name of the command, as presented on the command line, or if the
110
+ # command is packaged as a Docker container, as presented to `docker pull`.
111
+ # @!attribute [rw] env
112
+ # @return [Array<String>]
113
+ # Environment variables set before running this command.
114
+ # @!attribute [rw] args
115
+ # @return [Array<String>]
116
+ # Command-line arguments used when executing this command.
117
+ # @!attribute [rw] dir
118
+ # @return [String]
119
+ # Working directory (relative to project source root) used when running this
120
+ # command.
121
+ # @!attribute [rw] id
122
+ # @return [String]
123
+ # Optional unique identifier for this command, used in wait_for to reference
124
+ # this command as a dependency.
125
+ # @!attribute [rw] wait_for
126
+ # @return [Array<String>]
127
+ # The ID(s) of the command(s) that this command depends on.
128
+ class Command; end
129
+
130
+ # Artifact describes a build product.
131
+ # @!attribute [rw] checksum
132
+ # @return [String]
133
+ # Hash or checksum value of a binary, or Docker Registry 2.0 digest of a
134
+ # container.
135
+ # @!attribute [rw] id
136
+ # @return [String]
137
+ # Artifact ID, if any; for container images, this will be a URL by digest
138
+ # like `gcr.io/projectID/imagename@sha256:123456`.
139
+ # @!attribute [rw] names
140
+ # @return [Array<String>]
141
+ # Related artifact names. This may be the path to a binary or jar file, or in
142
+ # the case of a container build, the name used to push the container image to
143
+ # Google Container Registry, as presented to `docker push`. Note that a
144
+ # single Artifact ID can have multiple names, for example if two tags are
145
+ # applied to one image.
146
+ class Artifact; end
147
+
148
+ # A SourceContext is a reference to a tree of files. A SourceContext together
149
+ # with a path point to a unique revision of a single file or directory.
150
+ # @!attribute [rw] cloud_repo
151
+ # @return [Grafeas::V1::CloudRepoSourceContext]
152
+ # A SourceContext referring to a revision in a Google Cloud Source Repo.
153
+ # @!attribute [rw] gerrit
154
+ # @return [Grafeas::V1::GerritSourceContext]
155
+ # A SourceContext referring to a Gerrit project.
156
+ # @!attribute [rw] git
157
+ # @return [Grafeas::V1::GitSourceContext]
158
+ # A SourceContext referring to any third party Git repo (e.g., GitHub).
159
+ # @!attribute [rw] labels
160
+ # @return [Hash{String => String}]
161
+ # Labels with user defined metadata.
162
+ class SourceContext; end
163
+
164
+ # An alias to a repo revision.
165
+ # @!attribute [rw] kind
166
+ # @return [Grafeas::V1::AliasContext::Kind]
167
+ # The alias kind.
168
+ # @!attribute [rw] name
169
+ # @return [String]
170
+ # The alias name.
171
+ class AliasContext
172
+ # The type of an alias.
173
+ module Kind
174
+ # Unknown.
175
+ KIND_UNSPECIFIED = 0
176
+
177
+ # Git tag.
178
+ FIXED = 1
179
+
180
+ # Git branch.
181
+ MOVABLE = 2
182
+
183
+ # Used to specify non-standard aliases. For example, if a Git repo has a
184
+ # ref named "refs/foo/bar".
185
+ OTHER = 4
186
+ end
187
+ end
188
+
189
+ # A CloudRepoSourceContext denotes a particular revision in a Google Cloud
190
+ # Source Repo.
191
+ # @!attribute [rw] repo_id
192
+ # @return [Grafeas::V1::RepoId]
193
+ # The ID of the repo.
194
+ # @!attribute [rw] revision_id
195
+ # @return [String]
196
+ # A revision ID.
197
+ # @!attribute [rw] alias_context
198
+ # @return [Grafeas::V1::AliasContext]
199
+ # An alias, which may be a branch or tag.
200
+ class CloudRepoSourceContext; end
201
+
202
+ # A SourceContext referring to a Gerrit project.
203
+ # @!attribute [rw] host_uri
204
+ # @return [String]
205
+ # The URI of a running Gerrit instance.
206
+ # @!attribute [rw] gerrit_project
207
+ # @return [String]
208
+ # The full project name within the host. Projects may be nested, so
209
+ # "project/subproject" is a valid project name. The "repo name" is the
210
+ # hostURI/project.
211
+ # @!attribute [rw] revision_id
212
+ # @return [String]
213
+ # A revision (commit) ID.
214
+ # @!attribute [rw] alias_context
215
+ # @return [Grafeas::V1::AliasContext]
216
+ # An alias, which may be a branch or tag.
217
+ class GerritSourceContext; end
218
+
219
+ # A GitSourceContext denotes a particular revision in a third party Git
220
+ # repository (e.g., GitHub).
221
+ # @!attribute [rw] url
222
+ # @return [String]
223
+ # Git repository URL.
224
+ # @!attribute [rw] revision_id
225
+ # @return [String]
226
+ # Git commit hash.
227
+ class GitSourceContext; end
228
+
229
+ # A unique identifier for a Cloud Repo.
230
+ # @!attribute [rw] project_repo_id
231
+ # @return [Grafeas::V1::ProjectRepoId]
232
+ # A combination of a project ID and a repo name.
233
+ # @!attribute [rw] uid
234
+ # @return [String]
235
+ # A server-assigned, globally unique identifier.
236
+ class RepoId; end
237
+
238
+ # Selects a repo using a Google Cloud Platform project ID (e.g.,
239
+ # winged-cargo-31) and a repo name within that project.
240
+ # @!attribute [rw] project_id
241
+ # @return [String]
242
+ # The ID of the project.
243
+ # @!attribute [rw] repo_name
244
+ # @return [String]
245
+ # The name of the repo. Leave empty for the default repo.
246
+ class ProjectRepoId; end
247
+ end
248
+ end