Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit dff3c50

Browse files
committed
Update prototype tool to match new schema
Signed-off-by: Johnson Shi <[email protected]>
1 parent de0dc93 commit dff3c50

31 files changed

+5303
-4797
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,26 @@ The provenance schema will attest build provenance facts for each layer of a con
169169
// COPY-CommandLayer --> created by a plain COPY command
170170
// ADD-CommandLayer --> created by the ADD instruction
171171
// RUN-CommandLayer --> created by the RUN instruction
172+
"BaseImage": "null if not from a base image, else 'registry.io/base-image@digest'",
172173
"DockerfileCommands": [
173174
{
174175
"Cmd": "The Dockerfile instruction command, such as FROM, ADD, COPY, RUN, etc.",
175176
"SubCmd": "",
176177
"Json": true|false, whether the instruction was written in JSON form,
177178
"Original": "The original instruction in source, such as 'FROM docker.io/library/postgres:14-bullseye'",
178179
"StartLine": 30,
179-
// original source line number that starts this command
180+
// * Original source line number that starts this command
180181
"EndLine": 30,
181-
// the original source line number that ends this command
182+
// * The original source line number that ends this command
182183
"Flags": [],
183-
// Any flags such as `--from=...` for multistage `COPY` commands.
184+
// * Any flags such as `--from=...` for multistage `COPY` commands.
184185
"Value": [
185-
// The command's value args, e.g. for the FROM command: 'registry/repository:digest'.
186+
// * The command's value args, e.g. for the FROM command: 'registry/repository:digest'.
186187
"docker.io/library/postgres:14-bullseye"
187188
]
188189
}
189190
}
190191
],
191-
"BaseImage": "null if not from a base image, else 'registry.io/base-image@digest'",
192192
"AttributedEntity": {
193193
// AttributedEntity is a free-schema JSON-object for
194194
// maintainers to include attribution
@@ -320,12 +320,12 @@ Layer information where the vulnerable package was introduced:
320320
{
321321
"layerId": 1,
322322
"layerHash": "fef0f9958347a4b3c846fb8ea394fbcc554ec5440c7ec72b09786230d55ccc03",
323-
// No indication whether the vulnerable package or layer
323+
// * No indication whether the vulnerable package or layer
324324
// was introduced by a dependent base image
325325
// or from app code introduced by the image maintainer.
326326
"layerCommand": "ADD file:0a5fd3a659be172e86491f2b94fe4fcc48be603847554a6a8d3bbc87854affec in /"
327-
// Mangled layer command history due to image history limitations.
328-
// No indication whether the Dockerfile instruction
327+
// * Mangled layer command history due to image history limitations.
328+
// * No indication whether the Dockerfile instruction
329329
// was from a base image's build instructions
330330
// or from the maintainer's own
331331
// image config directives (e.g. Dockerfile instructions).
@@ -364,7 +364,7 @@ Layer information where the vulnerable package was introduced:
364364
"layerId": 1,
365365
"layerHash": "fef0f9958347a4b3c846fb8ea394fbcc554ec5440c7ec72b09786230d55ccc03",
366366
"layerCommand": "ADD file:0a5fd3a659be172e86491f2b94fe4fcc48be603847554a6a8d3bbc87854affec in /"
367-
// ADDITIONAL PROVENANCE GENERATED FROM IMAGE PROVENANCE DOC:
367+
// * ADDITIONAL PROVENANCE GENERATED FROM IMAGE PROVENANCE DOC:
368368
"layerProvenance": {
369369
"origin": "FROM-base-image-cmd, COPY-cmd, ADD-cmd, RUN-cmd",
370370
"baseImage": null OR "registry.io/image@digest",

cmd/cli/generate.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ func (opts *generateCmdOpts) writeManifestLayerHistory(manifestLayerHistory []hi
153153
timeNow := time.Now()
154154
for _, layerHistory := range manifestLayerHistory {
155155
layerSlsaProvenance := slsa.ImageManifestLayerSlsaProvenance{
156-
LayerHistory: layerHistory,
157-
BuilderID: "URI indicating the builder identity. E.g. pipeline-name",
158-
BuildType: "URI indicating what type of build was performed. E.g. build-type-dockerfile-build",
159-
BuildInvocationID: "Globally Unique Build Invocation ID. Definition: Identifies this particular build invocation, which can be useful for finding associated logs or other ad-hoc analysis. The exact meaning and format is defined by builder.id; by default it is treated as opaque and case-sensitive. The value SHOULD be globally unique.",
160-
BuildStartedOn: &timeNow,
161-
BuildFinishedOn: &timeNow,
162-
RepoURIContainingDockerfile: "URI to Git repo of Dockerfile. Describes where the config file that kicked off the build came from. URI indicating the identity of the source of the config. E.g. https://www.github.com/example/reponame/blob/master/Dockerfile",
163-
RepoGitCommit: "Git commit SHA that kicked off the build.",
164-
RepoPathToDockerfile: "Path to Dockerfile in the repo. Definition: String identifying the entry point into the build. This is often a path to a configuration file and/or a target label within that file. The syntax and meaning are defined by buildType. For example, if the buildType were “make”, then this would reference the directory in which to run make as well as which target to use.",
156+
LayerHistory: layerHistory,
157+
BuilderID: "Build pipeline URI.",
158+
BuildType: "Type of image build, such as 'dockerfile-build', 'buildkit-build', 'bazel-build', etc.",
159+
BuildInvocationID: "Build pipeline ID number",
160+
BuildStartedOn: &timeNow,
161+
BuildFinishedOn: &timeNow,
162+
RepoURIContainingImageSource: "URI to Git repo of image config. For Dockerfile builds, this is a git URI to the Dockerfile (e.g. github.com/org/repo/tree/main/Dockerfile)",
163+
RepoGitCommit: "Git commit SHA that kicked off the build.",
164+
RepoPathToImageSource: "Path to image config in the repo (e.g. path/to/Dockerfile)",
165165
}
166166
layerSlsaProvenanceStatement, err := layerSlsaProvenance.GetImageManifestLayerSlsaProvenance()
167167
if err != nil {

0 commit comments

Comments
 (0)