Commit Graph

238 Commits

Author SHA1 Message Date
Shunsuke Suzuki
a4d4074bf6 ci: fix a deprecation warning (#435)
> args
> The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>
2023-01-06 08:14:29 -06:00
Ian Lewis
452dcfac5f ci: Add large file pre-submit check (#433)
Signed-off-by: Ian Lewis <ianlewis@google.com>
2023-01-06 09:29:13 +09:00
asraa
844ae349df fix: remove accidental checked in binary (#432)
Signed-off-by: Asra Ali <asraa@google.com>
2023-01-06 08:06:43 +09:00
asraa
bad943298a ci: add verifier e2e presubmit that runs CLI at main (#430)
* ci: add verifier e2e presubmit that runs CLI at main

Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
2023-01-05 16:02:54 +00:00
Mend Renovate
71a4b4d2bb chore(deps): update npm dev (#428)
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2023-01-05 02:25:41 +00:00
asraa
dabf59b6dd fix: fix exit status on command executione errors (#429)
Signed-off-by: Asra Ali <asraa@google.com>

Signed-off-by: Asra Ali <asraa@google.com>
2023-01-04 10:34:51 -06:00
Mend Renovate
652ec10cf9 chore(deps): update ossf/scorecard-action action to v2.1.2 (#417)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: asraa <asraa@google.com>
2023-01-03 20:16:07 +00:00
Mihai Maruseac
a72569a87a fix: Use Run instead of RunE to handle usage/errors (#424)
* Use `Run` instead of `RunE` to handle usage/errors

We want to only display the usage message if there is an error in the
parsing of arguments. Once the arguments are parsed and we invoke the
internal implementation the usage message should not be displayed
anymore, regardless of what internal error gets returned. Fortunately,
the fix is easy.

Tested:

* passing scenario:
```
[...]$ slsa-verifier verify-artifact \
       --provenance-path multiple.intoto.jsonl \
       --source-uri github.com/example/repo fib
Verified signature against tlog entry index 9712459 at URL: ...
Verified build using builder ...
Verifying artifact fib: PASSED

PASSED: Verified SLSA provenance
```

* failing scenario with missing artifact file:
```
[...]$ slsa-verifier verify-artifact \
       --provenance-path multiple.intoto.jsonl \
       --source-uri github.com/example/repo fibs
Verifying artifact fibs: FAILED: open fibs: no such file or directory

FAILED: SLSA verification failed: open fibs: no such file or directory
```

* failing scenario with invalid artifact:
```
[...]$ slsa-verifier verify-artifact \
       --provenance-path multiple.intoto.jsonl \
       --source-uri github.com/example/repo multiple.intoto.jsonl
Verified signature against tlog entry index 9712459 at URL: ...
Verifying artifact multiple.intoto.jsonl: FAILED: expected hash ...

FAILED: SLSA verification failed: expected hash ...
```

* failing scenario due to invalid usage (missing required arguments):
```
[...]$ slsa-verifier verify-artifact \
       --provenance-path multiple.intoto.jsonl
Usage:
  slsa-verifier verify-artifact [flags] artifact [artifact..]

Flags:
      --build-workflow-input map[]    [optional] a workflow input provided by a user at trigger time in the format 'key=value'. (Only for 'workflow_dispatch' events on GitHub Actions). (default map[])
      --builder-id string             [optional] the unique builder ID who created the provenance
  -h, --help                          help for verify-artifact
      --print-provenance              [optional] print the verified provenance to stdout
      --provenance-path string        path to a provenance file
      --source-branch string          [optional] expected branch the binary was compiled from
      --source-tag string             [optional] expected tag the binary was compiled from
      --source-uri string             expected source repository that should have produced the binary, e.g. github.com/some/repo
      --source-versioned-tag string   [optional] expected version the binary was compiled from. Uses semantic version to match the tag

required flag(s) "source-uri" not set
exit status 1
```

Fixes #307

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Handle the same fix in image verification

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* go fmt

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
2023-01-03 14:08:01 -06:00
Mihai Maruseac
17463c02b3 fix: Expect at least one artifact in verification (#426)
* fix: Expect at least one artifact in verification

Fixes #425 introduces by #419

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* go fmt

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
2022-12-29 13:05:10 -08:00
Mihai Maruseac
e20f3cc7a3 feat: Verify all artifacts passed in cmdline (#419)
* Remove limit of number of artifacts to verify

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Update short description

Mention that we support multiple artifacts as long as they come from the
same provenance.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Verify all artifacts passed in cmdline

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Remove header of verify step output

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Format the `cobra.Command.Use` argument

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Don't return a slice of builderIDs.

Since all images should come from the same provenance file, there's an
invariant that we will always get exactly one builderID. So, no need to
return a slice of them.

Just to preempt the case when the invariant would be broken, add a
specific check.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Change existing tests to support multiple artifacts.

No new tests added, just changing table test data type.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* [nfc] Format test file

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Change test to allow passing multiple artifacts.

For now, just allow passing the entire array of artifacts to command
line / arguments. The functionality should still be the same.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Fix typo

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Fix path to test artifacts

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Allow different provenance path

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Try 2 artifacts from existing testdata

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Add more tests for multiple artifacts

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Add failing test

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Fix artifact and error

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Add final test: no artifact match

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

* Update README.md

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
2022-12-29 09:56:57 -08:00
asraa
19030f3b12 ci: add git sign off to renovate-bot (#420)
Signed-off-by: Asra Ali <asraa@google.com>

Signed-off-by: Asra Ali <asraa@google.com>
2022-12-28 15:27:47 -06:00
Mihai Maruseac
8279f4bf4c Enhance help message (#418)
One part that is missing in the output if invocation is wrong is that
there is no indication that user has to pass path to a file
(artifact/image).

The remaining potential errors from #173 are handled via #231.

Found while looking at #174.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
2022-12-28 14:24:04 -06:00
Mend Renovate
82cb42fb20 chore(deps): update dependency @types/node to v18.11.17 (#416) 2022-12-18 09:56:35 +09:00
Mend Renovate
5fd4ee25c1 chore(deps): update github-actions (#414)
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-12-17 07:11:23 +00:00
Mend Renovate
a88e26b866 chore(deps): update npm dev (#415) 2022-12-17 16:04:09 +09:00
Mend Renovate
b1aad15c35 chore(deps): update npm dev (#383)
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-12-16 00:41:58 +00:00
Mend Renovate
b40d88c1e7 chore(deps): update github-actions (#384)
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-12-15 01:59:36 +00:00
Mend Renovate
e8c3438638 fix(deps): update go (#386)
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-12-15 01:39:54 +00:00
Ian Lewis
f439833d5e Add regression build tag (#400)
Signed-off-by: Ian Lewis <ianlewis@google.com>
2022-12-15 01:25:04 +00:00
Ian Lewis
1dffc4b135 Use github.token to create issues (#412)
Signed-off-by: Ian Lewis <ianlewis@google.com>

Signed-off-by: Ian Lewis <ianlewis@google.com>
2022-12-14 17:09:42 -08:00
laurentsimon
f0aec773a6 update (#410)
Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-14 14:34:54 -08:00
laurentsimon
41d551cd45 update (#408)
Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-14 18:42:59 +00:00
laurentsimon
552cfc411d fix: token permission in Installer scheduled tests (#407)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-14 10:02:28 -08:00
asraa
0bd7a542b4 docs: update docs for release v2.0.1 (#403)
Signed-off-by: Asra Ali <asraa@google.com>

Signed-off-by: Asra Ali <asraa@google.com>
2022-12-14 16:11:34 +00:00
Ian Lewis
8510abc10f Add codeowners (#401)
Signed-off-by: Ian Lewis <ianlewis@google.com>
2022-12-14 03:05:04 +00:00
laurentsimon
b4257ed6bf Update schedule.installer.yml (#404)
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
2022-12-14 11:49:20 +09:00
laurentsimon
53b3aebdb9 feat: scheduled tests for installer Action (#398)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* Update .github/workflows/schedule.installer.yml

Co-authored-by: Ian Lewis <ianlewis@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-12-14 01:37:23 +00:00
laurentsimon
a43888265e fix: command in installer Action (#396)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>
v2.0.1
2022-12-08 22:32:57 +00:00
laurentsimon
901c5f7901 update (#394)
Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-06 15:16:10 -06:00
laurentsimon
4cba39a15a feat: Add env variable to facilitate CI tests of Action installer (#393)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-06 20:25:47 +00:00
laurentsimon
477ac0d88e fix: show version in version command (#392)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-06 20:13:35 +00:00
laurentsimon
4a6c5b1677 feat: add more tests for GCB verification (#389)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
2022-12-05 13:31:58 -08:00
Ian Lewis
267242e153 fix: Fix error check for decodeSignature (#385)
Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
2022-12-03 11:05:56 -08:00
laurentsimon
b9058c5596 docs: Add comment for signature decoding (#380)
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* Update verifiers/internal/gcb/provenance.go

Co-authored-by: asraa <asraa@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
Co-authored-by: asraa <asraa@google.com>
2022-12-02 19:34:29 +00:00
asraa
b6a9853023 docs: add release steps for a new major release (#378)
Signed-off-by: Asra Ali <asraa@google.com>

Signed-off-by: Asra Ali <asraa@google.com>
Co-authored-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
2022-12-02 18:16:18 +00:00
asraa
d50e89b559 fix: handle workflow input flag parsing (#379)
* fix: handle workflow input flag parsing

Signed-off-by: Asra Ali <asraa@google.com>

* add smoke tests

Signed-off-by: Asra Ali <asraa@google.com>

Signed-off-by: Asra Ali <asraa@google.com>
2022-12-02 10:01:20 -08:00
Shunsuke Suzuki
c9993a51d8 docs: fix go install (#376)
https://github.com/slsa-framework/slsa-verifier/pull/375#discussion_r1037775148

I found this doesn't work.
To install slsa-verifier v2 by go install, we have to release v2.0.1 or later.

```
go install github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier@v2.0.0
go: github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier@v2.0.0: github.com/slsa-framework/slsa-verifier@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("github.com/slsa-framework/slsa-verifier/v2")
```

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>
2022-12-02 09:16:40 -06:00
Shunsuke Suzuki
798db79f54 docs: add the checksum of v2.0.0 (#374)
Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-12-02 12:22:14 +09:00
Shunsuke Suzuki
59a3af3d90 docs: update slsa-verifier to v2.0.0 (#375)
Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>
Co-authored-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
2022-12-02 03:13:25 +00:00
Shunsuke Suzuki
74fd528309 fix: fix the Go package version to v2 (#373)
* fix: fix the package version to v2

```
git ls-files | grep ".go$" | xargs -n 1 gsed -i "s|github.com/slsa-framework/slsa-verifier|github.com/slsa-framework/slsa-verifier/v2|g"
```

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>

* fix: fix the package version to v2

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>

* test: fix source

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>

Signed-off-by: Shunsuke Suzuki <suzuki.shunsuke.1989@gmail.com>
2022-12-01 18:49:39 -08:00
asraa
128324f488 ci: add pr workflow to check pr title format (#372)
* ci: add pr workflow to check pr title format

Signed-off-by: Asra Ali <asraa@google.com>
v2.0.0
2022-11-30 21:35:33 +00:00
Mend Renovate
7bebbb9e1f chore(deps): update actions/dependency-review-action action to v3 (#358)
Co-authored-by: asraa <asraa@google.com>
2022-11-29 15:15:51 +00:00
Mend Renovate
0ef57a2b08 chore(deps): update github-actions (#359)
* chore(deps): update github-actions

* Update release.yml

Co-authored-by: asraa <asraa@google.com>
2022-11-28 18:02:24 +00:00
asraa
1c41687aac Update to reference v1.3.2 as latest version. (#369)
Signed-off-by: Ian Lewis <ianlewis@google.com>

Signed-off-by: Ian Lewis <ianlewis@google.com>
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-11-28 16:40:11 +00:00
Ian Lewis
3162d85faf Update README (#361)
Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
Co-authored-by: asraa <asraa@google.com>
2022-11-28 16:20:13 +00:00
Ian Lewis
2cd857d928 Update renovate config to group PRs (#368)
Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
2022-11-28 13:46:35 +09:00
Ian Lewis
28b554f525 Add golangci-lint and yamllint (#365)
* Add Makefile and yamllint config

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

* Add golangci-lint config

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

* Add golangci-lint config

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

* add linters to pre-submit

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

* add issue link to todos

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

* Fix whitespace issue

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
2022-11-28 10:19:59 +09:00
Mend Renovate
6cd5d4ac68 chore(deps): update github-actions (#351)
Co-authored-by: Ian Lewis <ianlewis@google.com>
2022-11-14 22:55:08 +00:00
Ian Lewis
bbe98e8f2e Add e2e tests for slsa-github-generator v1.2.2 (#355)
* Add e2e tests for slsa-github-generator v1.2.2

* Fix testdata

Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
2022-11-14 15:31:04 +00:00
Shunsuke Suzuki
f7bd16431b fix: fix error logs (#356) 2022-11-11 10:44:03 -06:00