Skip to content

Commit f7fc9c4

Browse files
feat: [grafeas] Support for Secrets (#13869)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Add support for Secrets feat: Add support for Layer Details END_COMMIT_OVERRIDE PiperOrigin-RevId: 754105940 Source-Link: googleapis/googleapis@079e530 Source-Link: googleapis/googleapis-gen@7b5fe85 Copy-Tag: eyJwIjoicGFja2FnZXMvZ3JhZmVhcy8uT3dsQm90LnlhbWwiLCJoIjoiN2I1ZmU4NWM4MmVlZDA0ZGYxMTFlNWE2MWU4MjVmMDQ0ODNjZTVhMiJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent d4fc92b commit f7fc9c4

File tree

9 files changed

+362
-2
lines changed

9 files changed

+362
-2
lines changed

packages/grafeas/grafeas/grafeas/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
)
2828
from grafeas.grafeas_v1.types.build import BuildNote, BuildOccurrence
2929
from grafeas.grafeas_v1.types.common import (
30+
BaseImage,
3031
Digest,
3132
Envelope,
3233
EnvelopeSignature,
3334
FileLocation,
35+
LayerDetails,
3436
License,
3537
NoteKind,
3638
RelatedUrl,
@@ -119,6 +121,13 @@
119121
SBOMReferenceNote,
120122
SBOMReferenceOccurrence,
121123
)
124+
from grafeas.grafeas_v1.types.secret import (
125+
SecretKind,
126+
SecretLocation,
127+
SecretNote,
128+
SecretOccurrence,
129+
SecretStatus,
130+
)
122131
from grafeas.grafeas_v1.types.severity import Severity
123132
from grafeas.grafeas_v1.types.slsa_provenance import SlsaProvenance
124133
from grafeas.grafeas_v1.types.slsa_provenance_zero_two import SlsaProvenanceZeroTwo
@@ -142,10 +151,12 @@
142151
"Jwt",
143152
"BuildNote",
144153
"BuildOccurrence",
154+
"BaseImage",
145155
"Digest",
146156
"Envelope",
147157
"EnvelopeSignature",
148158
"FileLocation",
159+
"LayerDetails",
149160
"License",
150161
"RelatedUrl",
151162
"Signature",
@@ -219,6 +230,11 @@
219230
"SbomReferenceIntotoPredicate",
220231
"SBOMReferenceNote",
221232
"SBOMReferenceOccurrence",
233+
"SecretLocation",
234+
"SecretNote",
235+
"SecretOccurrence",
236+
"SecretStatus",
237+
"SecretKind",
222238
"Severity",
223239
"SlsaProvenance",
224240
"SlsaProvenanceZeroTwo",

packages/grafeas/grafeas/grafeas_v1/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
from .types.attestation import AttestationNote, AttestationOccurrence, Jwt
2323
from .types.build import BuildNote, BuildOccurrence
2424
from .types.common import (
25+
BaseImage,
2526
Digest,
2627
Envelope,
2728
EnvelopeSignature,
2829
FileLocation,
30+
LayerDetails,
2931
License,
3032
NoteKind,
3133
RelatedUrl,
@@ -102,6 +104,13 @@
102104
SBOMReferenceNote,
103105
SBOMReferenceOccurrence,
104106
)
107+
from .types.secret import (
108+
SecretKind,
109+
SecretLocation,
110+
SecretNote,
111+
SecretOccurrence,
112+
SecretStatus,
113+
)
105114
from .types.severity import Severity
106115
from .types.slsa_provenance import SlsaProvenance
107116
from .types.slsa_provenance_zero_two import SlsaProvenanceZeroTwo
@@ -121,6 +130,7 @@
121130
"Artifact",
122131
"AttestationNote",
123132
"AttestationOccurrence",
133+
"BaseImage",
124134
"BatchCreateNotesRequest",
125135
"BatchCreateNotesResponse",
126136
"BatchCreateOccurrencesRequest",
@@ -169,6 +179,7 @@
169179
"InTotoStatement",
170180
"Jwt",
171181
"Layer",
182+
"LayerDetails",
172183
"License",
173184
"ListNoteOccurrencesRequest",
174185
"ListNoteOccurrencesResponse",
@@ -192,6 +203,11 @@
192203
"SBOMReferenceOccurrence",
193204
"SbomReferenceIntotoPayload",
194205
"SbomReferenceIntotoPredicate",
206+
"SecretKind",
207+
"SecretLocation",
208+
"SecretNote",
209+
"SecretOccurrence",
210+
"SecretStatus",
195211
"Severity",
196212
"Signature",
197213
"SlsaProvenance",

packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
image,
6060
package,
6161
sbom,
62+
secret,
6263
upgrade,
6364
vex,
6465
vulnerability,

packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
image,
7777
package,
7878
sbom,
79+
secret,
7980
upgrade,
8081
vex,
8182
vulnerability,

packages/grafeas/grafeas/grafeas_v1/types/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
from .attestation import AttestationNote, AttestationOccurrence, Jwt
1717
from .build import BuildNote, BuildOccurrence
1818
from .common import (
19+
BaseImage,
1920
Digest,
2021
Envelope,
2122
EnvelopeSignature,
2223
FileLocation,
24+
LayerDetails,
2325
License,
2426
NoteKind,
2527
RelatedUrl,
@@ -96,6 +98,13 @@
9698
SBOMReferenceNote,
9799
SBOMReferenceOccurrence,
98100
)
101+
from .secret import (
102+
SecretKind,
103+
SecretLocation,
104+
SecretNote,
105+
SecretOccurrence,
106+
SecretStatus,
107+
)
99108
from .severity import Severity
100109
from .slsa_provenance import SlsaProvenance
101110
from .slsa_provenance_zero_two import SlsaProvenanceZeroTwo
@@ -109,10 +118,12 @@
109118
"Jwt",
110119
"BuildNote",
111120
"BuildOccurrence",
121+
"BaseImage",
112122
"Digest",
113123
"Envelope",
114124
"EnvelopeSignature",
115125
"FileLocation",
126+
"LayerDetails",
116127
"License",
117128
"RelatedUrl",
118129
"Signature",
@@ -186,6 +197,11 @@
186197
"SbomReferenceIntotoPredicate",
187198
"SBOMReferenceNote",
188199
"SBOMReferenceOccurrence",
200+
"SecretLocation",
201+
"SecretNote",
202+
"SecretOccurrence",
203+
"SecretStatus",
204+
"SecretKind",
189205
"Severity",
190206
"SlsaProvenance",
191207
"SlsaProvenanceZeroTwo",

packages/grafeas/grafeas/grafeas_v1/types/common.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"Envelope",
2929
"EnvelopeSignature",
3030
"FileLocation",
31+
"BaseImage",
32+
"LayerDetails",
3133
"License",
3234
"Digest",
3335
},
@@ -70,6 +72,8 @@ class NoteKind(proto.Enum):
7072
This represents a Vulnerability Assessment.
7173
SBOM_REFERENCE (12):
7274
This represents an SBOM Reference.
75+
SECRET (13):
76+
This represents a secret.
7377
"""
7478
NOTE_KIND_UNSPECIFIED = 0
7579
VULNERABILITY = 1
@@ -84,6 +88,7 @@ class NoteKind(proto.Enum):
8488
DSSE_ATTESTATION = 10
8589
VULNERABILITY_ASSESSMENT = 11
8690
SBOM_REFERENCE = 12
91+
SECRET = 13
8792

8893

8994
class RelatedUrl(proto.Message):
@@ -236,12 +241,95 @@ class FileLocation(proto.Message):
236241
For jars that are contained inside .war
237242
files, this filepath can indicate the path to
238243
war file combined with the path to jar file.
244+
layer_details (grafeas.grafeas_v1.types.LayerDetails):
245+
Each package found in a file should have its
246+
own layer metadata (that is, information from
247+
the origin layer of the package).
239248
"""
240249

241250
file_path: str = proto.Field(
242251
proto.STRING,
243252
number=1,
244253
)
254+
layer_details: "LayerDetails" = proto.Field(
255+
proto.MESSAGE,
256+
number=2,
257+
message="LayerDetails",
258+
)
259+
260+
261+
class BaseImage(proto.Message):
262+
r"""BaseImage describes a base image of a container image.
263+
264+
Attributes:
265+
name (str):
266+
The name of the base image.
267+
repository (str):
268+
The repository name in which the base image
269+
is from.
270+
layer_count (int):
271+
The number of layers that the base image is
272+
composed of.
273+
"""
274+
275+
name: str = proto.Field(
276+
proto.STRING,
277+
number=1,
278+
)
279+
repository: str = proto.Field(
280+
proto.STRING,
281+
number=2,
282+
)
283+
layer_count: int = proto.Field(
284+
proto.INT32,
285+
number=3,
286+
)
287+
288+
289+
class LayerDetails(proto.Message):
290+
r"""Details about the layer a package was found in.
291+
292+
Attributes:
293+
index (int):
294+
The index of the layer in the container
295+
image.
296+
diff_id (str):
297+
The diff ID (typically a sha256 hash) of the
298+
layer in the container image.
299+
chain_id (str):
300+
The layer chain ID (sha256 hash) of the layer
301+
in the container image.
302+
https://github.com/opencontainers/image-spec/blob/main/config.md#layer-chainid
303+
command (str):
304+
The layer build command that was used to
305+
build the layer. This may not be found in all
306+
layers depending on how the container image is
307+
built.
308+
base_images (MutableSequence[grafeas.grafeas_v1.types.BaseImage]):
309+
The base images the layer is found within.
310+
"""
311+
312+
index: int = proto.Field(
313+
proto.INT32,
314+
number=1,
315+
)
316+
diff_id: str = proto.Field(
317+
proto.STRING,
318+
number=2,
319+
)
320+
chain_id: str = proto.Field(
321+
proto.STRING,
322+
number=5,
323+
)
324+
command: str = proto.Field(
325+
proto.STRING,
326+
number=3,
327+
)
328+
base_images: MutableSequence["BaseImage"] = proto.RepeatedField(
329+
proto.MESSAGE,
330+
number=4,
331+
message="BaseImage",
332+
)
245333

246334

247335
class License(proto.Message):

packages/grafeas/grafeas/grafeas_v1/types/grafeas.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from grafeas.grafeas_v1.types import image as g_image
3232
from grafeas.grafeas_v1.types import package as g_package
3333
from grafeas.grafeas_v1.types import sbom
34+
from grafeas.grafeas_v1.types import secret as g_secret
3435
from grafeas.grafeas_v1.types import upgrade as g_upgrade
3536
from grafeas.grafeas_v1.types import vex
3637
from grafeas.grafeas_v1.types import vulnerability as g_vulnerability
@@ -151,6 +152,10 @@ class Occurrence(proto.Message):
151152
Describes a specific SBOM reference
152153
occurrences.
153154
155+
This field is a member of `oneof`_ ``details``.
156+
secret (grafeas.grafeas_v1.types.SecretOccurrence):
157+
Describes a secret.
158+
154159
This field is a member of `oneof`_ ``details``.
155160
envelope (grafeas.grafeas_v1.types.Envelope):
156161
https://github.com/secure-systems-lab/dsse
@@ -253,6 +258,12 @@ class Occurrence(proto.Message):
253258
oneof="details",
254259
message=sbom.SBOMReferenceOccurrence,
255260
)
261+
secret: g_secret.SecretOccurrence = proto.Field(
262+
proto.MESSAGE,
263+
number=20,
264+
oneof="details",
265+
message=g_secret.SecretOccurrence,
266+
)
256267
envelope: common.Envelope = proto.Field(
257268
proto.MESSAGE,
258269
number=18,
@@ -347,6 +358,10 @@ class Note(proto.Message):
347358
sbom_reference (grafeas.grafeas_v1.types.SBOMReferenceNote):
348359
A note describing an SBOM reference.
349360
361+
This field is a member of `oneof`_ ``type``.
362+
secret (grafeas.grafeas_v1.types.SecretNote):
363+
A note describing a secret.
364+
350365
This field is a member of `oneof`_ ``type``.
351366
"""
352367

@@ -463,6 +478,12 @@ class Note(proto.Message):
463478
oneof="type",
464479
message=sbom.SBOMReferenceNote,
465480
)
481+
secret: g_secret.SecretNote = proto.Field(
482+
proto.MESSAGE,
483+
number=22,
484+
oneof="type",
485+
message=g_secret.SecretNote,
486+
)
466487

467488

468489
class GetOccurrenceRequest(proto.Message):

0 commit comments

Comments
 (0)