|
20 | 20 | - [Compilation from source](#compilation-from-source)
|
21 | 21 | - [Option 1: Install via go](#option-1-install-via-go)
|
22 | 22 | - [Option 2: Compile manually](#option-2-compile-manually)
|
23 |
| - - [Use the installer Action on GitHub](#use-the-installer-action-on-github-actions) |
| 23 | + - [Use the installer Action on GitHub Actions](#use-the-installer-action-on-github-actions) |
24 | 24 | - [Download the binary](#download-the-binary)
|
25 | 25 | - [Available options](#available-options)
|
26 | 26 | - [Option list](#option-list)
|
|
31 | 31 | - [Verification for Google Cloud Build](#verification-for-google-cloud-build)
|
32 | 32 | - [Artifacts](#artifacts-1)
|
33 | 33 | - [Containers](#containers-1)
|
| 34 | +- [Verification for npm packages](#verification-for-npm-packages) |
| 35 | + - [The verify-npm-package command](#the-verify-npm-package-command) |
| 36 | + - [Verify npm packages built using the SLSA3 Node.js builder](#verify-npm-packages-built-using-the-slsa3-nodejs-builder) |
34 | 37 | - [Known Issues](#known-issues)
|
35 | 38 | - [tuf: invalid key](#tuf-invalid-key)
|
36 | 39 | - [panic: assignment to entry in nil map](#panic-assignment-to-entry-in-nil-map)
|
@@ -217,11 +220,17 @@ Verified build using builder https://github.com/slsa-framework/slsa-github-gener
|
217 | 220 | PASSED: Verified SLSA provenance
|
218 | 221 | ```
|
219 | 222 |
|
220 |
| -The verified in-toto statement may be written to stdout with the `--print-provenance` flag to pipe into policy engines. |
| 223 | +The verified in-toto statement may be written to stdout with the |
| 224 | +`--print-provenance` flag to pipe into policy engines. |
221 | 225 |
|
222 |
| -Only GitHub URIs are supported with the `--source-uri` flag. A tag should not be specified, even if the provenance was built at some tag. If you intend to do source versioning validation, use `--print-provenance` and inspect the commit SHA of the config source or materials. |
| 226 | +Only GitHub URIs are supported with the `--source-uri` flag. A tag should not |
| 227 | +be specified, even if the provenance was built at some tag. If you intend to do |
| 228 | +source versioning validation, you can use `--source-tag` to validate the |
| 229 | +release tag. For commit SHA validation, use `--print-provenance` and inspect |
| 230 | +the commit SHA of the config source or materials. |
223 | 231 |
|
224 |
| -Multiple artifacts built from the same GitHub builder can be verified in the same command, by passing them in the same command line as arguments: |
| 232 | +Multiple artifacts built from the same GitHub builder can be verified in the |
| 233 | +same command, by passing them in the same command line as arguments: |
225 | 234 |
|
226 | 235 | ```bash
|
227 | 236 | $ slsa-verifier verify-artifact \
|
@@ -316,10 +325,71 @@ You should see that the verification passed in the output.
|
316 | 325 | PASSED: Verified SLSA provenance
|
317 | 326 | ```
|
318 | 327 |
|
319 |
| -The verified in-toto statement may be written to stdout with the `--print-provenance` flag to pipe into policy engines. |
| 328 | +The verified in-toto statement may be written to stdout with the |
| 329 | +`--print-provenance` flag to pipe into policy engines. |
320 | 330 |
|
321 | 331 | Note that `--source-uri` supports GitHub repository URIs like `github.com/$OWNER/$REPO` when the build was enabled with a Cloud Build [GitHub trigger](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github). Otherwise, the build provenance will contain the name of the Cloud Storage bucket used to host the source files, usually of the form `gs://[PROJECT_ID]_cloudbuild/source` (see [Running build](https://cloud.google.com/build/docs/running-builds/submit-build-via-cli-api#running_builds)). We recommend using GitHub triggers in order to preserve the source provenance and valiate that the source came from an expected, version-controlled repository. You _may_ match on the fully-qualified tar like `gs://[PROJECT_ID]_cloudbuild/source/1665165360.279777-955d1904741e4bbeb3461080299e929a.tgz`.
|
322 | 332 |
|
| 333 | +## Verification for npm packages |
| 334 | + |
| 335 | +Verification of npm packages is currently an experimental feature. |
| 336 | + |
| 337 | +### The verify-npm-package command |
| 338 | + |
| 339 | +```bash |
| 340 | +$ slsa-verifier verify-npm-package --help |
| 341 | +Verifies SLSA provenance for an npm package tarball [experimental] |
| 342 | + |
| 343 | +Usage: |
| 344 | + slsa-verifier verify-npm-package [flags] tarball |
| 345 | + |
| 346 | +Flags: |
| 347 | + --attestations-path string path to a file containing the attestations |
| 348 | + --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[]) |
| 349 | + --builder-id string [optional] the unique builder ID who created the provenance |
| 350 | + -h, --help help for verify-npm-package |
| 351 | + --package-name string [optional] the package name |
| 352 | + --package-version string [optional] the package version |
| 353 | + --print-provenance [optional] print the verified provenance to stdout |
| 354 | + --source-branch string [optional] expected branch the binary was compiled from |
| 355 | + --source-tag string [optional] expected tag the binary was compiled from |
| 356 | + --source-uri string expected source repository that should have produced the binary, e.g. github.com/some/repo |
| 357 | + --source-versioned-tag string [optional] expected version the binary was compiled from. Uses semantic version to match the tag |
| 358 | +``` |
| 359 | + |
| 360 | +### Verify npm packages built using the SLSA3 Node.js builder |
| 361 | + |
| 362 | +This section describes how to verify packages built using the SLSA Build L3 |
| 363 | +[Node.js builder](https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/nodejs/README.md). |
| 364 | + |
| 365 | +To verify a npm packages, first download the package tarball and attestations. |
| 366 | + |
| 367 | +```shell |
| 368 | +curl -Sso attestations.json $(npm view @ianlewis/[email protected] --json | jq -r '.dist.attestations.url') && \ |
| 369 | +curl -Sso actions-test.tgz "$(npm view @ianlewis/[email protected] --json | jq -r '.dist.tarball')" |
| 370 | +``` |
| 371 | + |
| 372 | +You can then verify the package by running the following command: |
| 373 | + |
| 374 | +```shell |
| 375 | +$ SLSA_VERIFIER_EXPERIMENTAL=1 slsa-verifier verify-npm-package actions-test.tgz \ |
| 376 | + --attestations-path attestations.json \ |
| 377 | + --builder-id "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/builder_nodejs_slsa3.yml" \ |
| 378 | + --package-name "@ianlewis/actions-test" \ |
| 379 | + --package-version 0.1.126 \ |
| 380 | + --source-uri github.com/ianlewis/actions-test |
| 381 | +``` |
| 382 | + |
| 383 | +The verified in-toto statement may be written to stdout with the |
| 384 | +`--print-provenance` flag to pipe into policy engines. |
| 385 | + |
| 386 | +Only GitHub URIs are supported with the `--source-uri` flag. A tag should not |
| 387 | +be specified, even if the provenance was built at some tag. If you intend to do |
| 388 | +source versioning validation, you can use `--source-tag` to validate the |
| 389 | +release tag and `--package-version` to validate the package version. For commit |
| 390 | +SHA validation, use `--print-provenance` and inspect the commit SHA of the |
| 391 | +config source or materials. |
| 392 | + |
323 | 393 | ## Known Issues
|
324 | 394 |
|
325 | 395 | ### tuf: invalid key
|
|
0 commit comments