Skip to content

Commit 2f8150d

Browse files
committed
cosign/tuf: PR feedback
Signed-off-by: Jack Leightcap <[email protected]>
1 parent a4467ee commit 2f8150d

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ tokio = { version = "1.17.0", features = ["rt"] }
118118
tough = { version = "0.14", features = ["http"], optional = true }
119119
tracing = "0.1.31"
120120
url = "2.2.2"
121-
x509-cert = { version = "0.2.2", features = ["builder", "pem", "std"] }
121+
x509-cert = { version = "0.2.2", features = ["pem", "std"] }
122122
crypto_secretbox = "0.1.1"
123123
zeroize = "1.5.7"
124124
rustls-webpki = { version = "0.102.0-alpha.4", features = ["alloc"] }

examples/cosign/verify/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ async fn fulcio_and_rekor_data(cli: &Cli) -> anyhow::Result<Box<dyn sigstore::tu
240240
return Ok(Box::new(repo?));
241241
};
242242

243-
let mut data = sigstore::tuf::FakeRepository::default();
243+
let mut data = sigstore::tuf::ManualRepository::default();
244244
if let Some(path) = cli.rekor_pub_key.as_ref() {
245245
data.rekor_key = Some(
246246
fs::read(path)

src/cosign/client_builder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ use crate::tuf::Repository;
2828
/// ## Rekor integration
2929
///
3030
/// Rekor integration can be enabled by specifying Rekor's public key.
31-
/// This can be provided via a [`crate::tuf::FakeRepository`].
31+
/// This can be provided via a [`crate::tuf::ManualRepository`].
3232
///
3333
/// > Note well: the [`tuf`](crate::tuf) module provides helper structs and methods
3434
/// > to obtain this data from the official TUF repository of the Sigstore project.
3535
///
3636
/// ## Fulcio integration
3737
///
3838
/// Fulcio integration can be enabled by specifying Fulcio's certificate.
39-
/// This can be provided via a [`crate::tuf::FakeRepository`].
39+
/// This can be provided via a [`crate::tuf::ManualRepository`].
4040
///
4141
/// > Note well: the [`tuf`](crate::tuf) module provides helper structs and methods
4242
/// > to obtain this data from the official TUF repository of the Sigstore project.
@@ -56,7 +56,6 @@ pub struct ClientBuilder<'a> {
5656
oci_client_config: ClientConfig,
5757
rekor_pub_key: Option<&'a [u8]>,
5858
fulcio_certs: Vec<CertificateDer<'a>>,
59-
// repo: Repository
6059
#[cfg(feature = "cached-client")]
6160
enable_registry_caching: bool,
6261
}

src/cosign/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ pub trait CosignCapabilities {
102102
/// must be satisfied:
103103
///
104104
/// * The [`sigstore::cosign::Client`](crate::cosign::client::Client) must
105-
/// have been created with Rekor integration enabled (see [`crate::tuf::FakeRepository`])
105+
/// have been created with Rekor integration enabled (see [`crate::tuf::ManualRepository`])
106106
/// * The [`sigstore::cosign::Client`](crate::cosign::client::Client) must
107-
/// have been created with Fulcio integration enabled (see [`crate::tuf::FakeRepository])
107+
/// have been created with Fulcio integration enabled (see [`crate::tuf::ManualRepository])
108108
/// * The layer must include a bundle produced by Rekor
109109
///
110110
/// > Note well: the [`tuf`](crate::tuf) module provides helper structs and methods

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
//! data: fulcio_cert_data
9393
//! };
9494
//!
95-
//! let mut repo = sigstore::tuf::FakeRepository {
95+
//! let mut repo = sigstore::tuf::ManualRepository {
9696
//! fulcio_certs: Some(vec![fulcio_cert.try_into().unwrap()]),
9797
//! rekor_key: Some(rekor_pub_key),
9898
//! ..Default::default()

src/tuf/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ mod trustroot;
4343
use rustls_pki_types::CertificateDer;
4444
use sha2::{Digest, Sha256};
4545
use tough::TargetName;
46+
use tracing::debug;
4647

4748
use self::trustroot::{CertificateAuthority, TimeRange, TransparencyLogInstance, TrustedRoot};
4849

@@ -54,15 +55,15 @@ pub trait Repository {
5455
fn rekor_keys(&self) -> Result<Vec<&[u8]>>;
5556
}
5657

57-
/// A `FakeRepository` is a [Repository] with out-of-band trust materials.
58+
/// A `ManualRepository` is a [Repository] with out-of-band trust materials.
5859
/// As it does not establish a trust root with TUF, users must initialize its materials themselves.
5960
#[derive(Debug, Default)]
60-
pub struct FakeRepository<'a> {
61+
pub struct ManualRepository<'a> {
6162
pub fulcio_certs: Option<Vec<CertificateDer<'a>>>,
6263
pub rekor_key: Option<Vec<u8>>,
6364
}
6465

65-
impl Repository for FakeRepository<'_> {
66+
impl Repository for ManualRepository<'_> {
6667
fn fulcio_certs(&self) -> Result<Vec<CertificateDer>> {
6768
Ok(match &self.fulcio_certs {
6869
Some(certs) => certs.clone(),
@@ -120,7 +121,7 @@ impl SigstoreRepository {
120121
local_path.as_ref(),
121122
)?;
122123

123-
println!("data:\n{}", String::from_utf8_lossy(&data));
124+
debug!("data:\n{}", String::from_utf8_lossy(&data));
124125

125126
Ok(serde_json::from_slice(&data[..])?)
126127
}

0 commit comments

Comments
 (0)