feat(publish): provenance attestation (#22573)

Supply chain security for JSR.

```
$ deno publish --provenance

Successfully published @divy/test_provenance@0.0.3
Provenance transparency log available at https://search.sigstore.dev/?logIndex=73657418
```

0. Package has been published.
1. Fetches the version manifest and verifies it's matching with uploaded
files and exports.
2. Builds the attestation SLSA payload using Github actions env.
3. Creates an ephemeral key pair for signing the github token
(aud=sigstore) and DSSE pre authentication tag.
4. Requests a X.509 signing certificate from Fulcio using the challenge
and ephemeral public key PEM.
5. Prepares a DSSE envelop for Rekor to witness. Posts an intoto entry
to Rekor and gets back the transparency log index.
6. Builds the provenance bundle and posts it to JSR.
This commit is contained in:
Divy Srivastava 2024-02-28 07:58:02 +05:30 committed by GitHub
parent e9fe71acb5
commit 9b5d2f8c1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1164 additions and 4 deletions

View file

@ -25,7 +25,9 @@ use super::unfurl::SpecifierUnfurler;
#[derive(Debug, Clone, PartialEq)]
pub struct PublishableTarballFile {
pub path_str: String,
pub specifier: Url,
pub hash: String,
pub size: usize,
}
@ -153,7 +155,10 @@ pub fn create_gzipped_tarball(
diagnostics_collector,
)?;
files.push(PublishableTarballFile {
path_str: path_str.clone(),
specifier: specifier.clone(),
// This hash string matches the checksum computed by registry
hash: format!("sha256-{:x}", sha2::Sha256::digest(&content)),
size: content.len(),
});
tar