This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from aquaproj/chore/add-file-extension-exe-to-w…
…indows-artifacts Merge upstream
- Loading branch information
Showing
9 changed files
with
115 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ We have no plan to maintain this repository actively. | |
- [Compilation from source](#compilation-from-source) | ||
- [Option 1: Install via go](#option-1-install-via-go) | ||
- [Option 2: Compile manually](#option-2-compile-manually) | ||
- [Option 3: Use the installer Action](#option-3-use-the-installer-action) | ||
- [Download the binary](#download-the-binary) | ||
- [Available options](#available-options) | ||
- [Option list](#option-list) | ||
|
@@ -136,19 +137,52 @@ You have two options to install the verifier. | |
|
||
#### Option 1: Install via go | ||
|
||
``` | ||
If you want to install the verifier, you can run the following command: | ||
```bash | ||
$ go install github.com/slsa-framework/slsa-verifier/v2/cli/[email protected] | ||
$ slsa-verifier <options> | ||
``` | ||
|
||
#### Option 2: Compile manually | ||
Tools like [dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates) or [renovate](https://github.com/renovatebot/renovate) use your project's go.mod to identify the version of your Go dependencies. | ||
If you install the verifier binary in CI, we strongly recommend you create a placeholder `go.mod` containing slsa-verifier as a dependency to receive updates and keep the binary up-to-date. Use the following the steps: | ||
|
||
1. Create a tooling/tooling_test.go file containing the following: | ||
```go | ||
//go:build tools | ||
// +build tools | ||
|
||
package main | ||
|
||
import ( | ||
_ "github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier" | ||
) | ||
``` | ||
|
||
1. Run the following commands in the tooling directory. (It will create a go.sum file.) | ||
```bash | ||
$ go mod init <your-project-name>-tooling | ||
$ go mod tidy | ||
``` | ||
|
||
1. Commit the tooling folder (containing the 3 files tooling_test.go, go.mod and go.sum) to the repository. | ||
1. To install the verifier in your CI, run the following commands: | ||
```bash | ||
$ cd tooling | ||
$ grep _ tooling_test.go | cut -f2 -d '"' | xargs -n1 -t go install | ||
``` | ||
|
||
#### Option 2: Compile manually | ||
|
||
```bash | ||
$ git clone [email protected]:slsa-framework/slsa-verifier.git | ||
$ cd slsa-verifier && git checkout v2.0.1 | ||
$ go run ./cli/slsa-verifier <options> | ||
``` | ||
|
||
#### Option 3: Use the installer Action | ||
|
||
If you need to install the verifier to run in a GitHub workflow, use the installer Action as described in [actions/installer/README.md](./actions/installer/README.md). | ||
|
||
### Download the binary | ||
|
||
Download the binary from the latest release at [https://github.com/slsa-framework/slsa-verifier/releases/tag/v2.0.1](https://github.com/slsa-framework/slsa-verifier/releases/tag/v2.0.1) | ||
|
@@ -157,7 +191,7 @@ Download the [SHA256SUM.md](https://github.com/slsa-framework/slsa-verifier/blob | |
|
||
Verify the checksum: | ||
|
||
``` | ||
```bash | ||
$ sha256sum -c --strict SHA256SUM.md | ||
slsa-verifier-linux-amd64: OK | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,10 +160,11 @@ func Test_VerifyDigest(t *testing.T) { | |
func Test_verifySourceURI(t *testing.T) { | ||
t.Parallel() | ||
tests := []struct { | ||
name string | ||
prov *intoto.ProvenanceStatement | ||
sourceURI string | ||
expected error | ||
name string | ||
prov *intoto.ProvenanceStatement | ||
sourceURI string | ||
allowNoMaterialRef bool | ||
expected error | ||
// v1 provenance does not include materials | ||
skipv1 bool | ||
}{ | ||
|
@@ -288,6 +289,45 @@ func Test_verifySourceURI(t *testing.T) { | |
}, | ||
sourceURI: "https://github.com/some/repo", | ||
}, | ||
{ | ||
name: "match source no git no material ref", | ||
prov: &intoto.ProvenanceStatement{ | ||
Predicate: slsa02.ProvenancePredicate{ | ||
Invocation: slsa02.ProvenanceInvocation{ | ||
ConfigSource: slsa02.ConfigSource{ | ||
URI: "git+https://github.com/some/[email protected]", | ||
}, | ||
}, | ||
Materials: []slsacommon.ProvenanceMaterial{ | ||
{ | ||
URI: "git+https://github.com/some/repo", | ||
}, | ||
}, | ||
}, | ||
}, | ||
allowNoMaterialRef: true, | ||
sourceURI: "https://github.com/some/repo", | ||
}, | ||
{ | ||
name: "match source no git no material ref ref not allowed", | ||
prov: &intoto.ProvenanceStatement{ | ||
Predicate: slsa02.ProvenancePredicate{ | ||
Invocation: slsa02.ProvenanceInvocation{ | ||
ConfigSource: slsa02.ConfigSource{ | ||
URI: "git+https://github.com/some/[email protected]", | ||
}, | ||
}, | ||
Materials: []slsacommon.ProvenanceMaterial{ | ||
{ | ||
URI: "git+https://github.com/some/repo", | ||
}, | ||
}, | ||
}, | ||
}, | ||
sourceURI: "https://github.com/some/repo", | ||
expected: serrors.ErrorMalformedURI, | ||
skipv1: true, | ||
}, | ||
{ | ||
name: "match source no git+https", | ||
prov: &intoto.ProvenanceStatement{ | ||
|
@@ -412,7 +452,7 @@ func Test_verifySourceURI(t *testing.T) { | |
ProvenanceStatement: tt.prov, | ||
} | ||
|
||
err := verifySourceURI(prov02, tt.sourceURI, true) | ||
err := verifySourceURI(prov02, tt.sourceURI, tt.allowNoMaterialRef) | ||
if !errCmp(err, tt.expected) { | ||
t.Errorf(cmp.Diff(err, tt.expected)) | ||
} | ||
|
@@ -433,7 +473,7 @@ func Test_verifySourceURI(t *testing.T) { | |
}, | ||
}, | ||
} | ||
err = verifySourceURI(prov1, tt.sourceURI, true) | ||
err = verifySourceURI(prov1, tt.sourceURI, tt.allowNoMaterialRef) | ||
if !errCmp(err, tt.expected) { | ||
t.Errorf(cmp.Diff(err, tt.expected)) | ||
} | ||
|