summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-02-28 07:58:02 +0530
committerGitHub <noreply@github.com>2024-02-28 07:58:02 +0530
commit9b5d2f8c1bae498d78400c8e9263bcae6e521adf (patch)
tree69453f9be9fc65774f3087bb986409aadee5acb4 /cli/args/flags.rs
parente9fe71acb53c8856754ef892c463253cb96087ce (diff)
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.
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index ca285112e..fa8471deb 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -302,6 +302,7 @@ pub struct PublishFlags {
pub token: Option<String>,
pub dry_run: bool,
pub allow_slow_types: bool,
+ pub provenance: bool,
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -2395,6 +2396,12 @@ fn publish_subcommand() -> Command {
.help("Allow publishing with slow types")
.action(ArgAction::SetTrue),
)
+ .arg(
+ Arg::new("provenance")
+ .long("provenance")
+ .help("From CI/CD system, publicly links the package to where it was built and published from.")
+ .action(ArgAction::SetTrue)
+ )
.arg(check_arg(/* type checks by default */ true))
.arg(no_check_arg())
})
@@ -3835,6 +3842,7 @@ fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) {
token: matches.remove_one("token"),
dry_run: matches.get_flag("dry-run"),
allow_slow_types: matches.get_flag("allow-slow-types"),
+ provenance: matches.get_flag("provenance"),
});
}
@@ -8565,6 +8573,26 @@ mod tests {
token: Some("asdf".to_string()),
dry_run: true,
allow_slow_types: true,
+ provenance: false,
+ }),
+ type_check_mode: TypeCheckMode::Local,
+ ..Flags::default()
+ }
+ );
+ }
+
+ #[test]
+ fn publish_provenance_args() {
+ let r =
+ flags_from_vec(svec!["deno", "publish", "--provenance", "--token=asdf",]);
+ assert_eq!(
+ r.unwrap(),
+ Flags {
+ subcommand: DenoSubcommand::Publish(PublishFlags {
+ token: Some("asdf".to_string()),
+ dry_run: false,
+ allow_slow_types: false,
+ provenance: true,
}),
type_check_mode: TypeCheckMode::Local,
..Flags::default()