Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work in progress - Add SLSA Provenance #3148

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matglas
Copy link
Contributor

@matglas matglas commented May 8, 2024

Implementation of #3121.

Open for feedback and input. These are some initial commits to add SLSA Provenance output based on in-toto attestations. I'm personally involved with in-toto project.

The implementation is inspired by a implementation done in Witness. in-toto/go-witness#149
This is one of the client implementations of in-toto attestations / SLSA Provenance by the in-toto project itself.

Example structure of SLSA Provenance

{
    // This is predefined
    "_type": "https://in-toto.io/Statement/v1",

    // This is predefined
    "predicateType": "https://slsa.dev/provenance/v1",
    
    // This follows a schema.
    "predicate": {

        "buildDefinition": {
            "buildType": "hhttps://please.build/buildtypes/[email protected]",  // Implemented

            "externalParameters": {
                "profile": [".plzconfig.ci", ".plzconfig.local"],
                "targets": ["//foo:bar"],                                // Implemented
                "include": ["baz"],
                "exclude": ["pop"]
            },

            // Maybe put the final config in here.
            "internalParameters": {
		"version": "v17.8.5",  // Implemented
		"buildConfig": {
                	"build_id": "123456",
                },
		"buildEnv": {
                	"DOO": "tee"
                },
                "plugins": [{
	                "shell": {
		                "uri": "git+https://github.com/please-build/shell.git",
		                "digest": {
			               "gitCommit": "c27d339ee6075c1f744c5d4b200f7901aad2c369"
		                }
	                }}
                ]
            },
            "resolvedDependencies": [
                {
                    "uri": "git+https://github.com/octocat/hello-world@refs/heads/main",
                    "digest": {
                        "gitCommit": "c27d339ee6075c1f744c5d4b200f7901aad2c369"
                    }
                },
                {
                    "uri": "https://github.com/actions/virtual-environments/releases/tag/ubuntu20/20220515.1"
                }
            ]
        },
        "runDetails": {
            "builder": {
                "id": "https://please.build/slsa-framework/slsa-level-1@refs/tags/v0.0.1"
            },

            // Optional. Maybe set the invocationId with a command argument.
            "metadata": {
                "invocationId": "https://ci.example.com/job/1",
                "startedOn": "2023-01-01T12:34:56Z",
                "finishedOn": "2023-01-01T12:44:56Z"
            }
        }
    },
    "subject": [
        {
            "name": "file://plz-out/gen/foo/bar.txt",
            "digest": {
                "sha256": "fe4fe40ac7250263c5dbe1cf3138912f3f416140aa248637a60d65fe22c47da4"
            }
        }
    ]
}

Todo

  • Implement Internal Parameters
  • Implement External Parameters
  • Implement resolved dependencies

matglas added 2 commits April 19, 2024 11:00
Signed-off-by: Matthias Glastra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant