Skip to content

Commit

Permalink
Merge pull request #14 from ereslibre/accept_invalid_hostnames_optional
Browse files Browse the repository at this point in the history
Make accept_invalid_hostnames conditional
  • Loading branch information
flavio authored Jan 17, 2022
2 parents 9a4447c + aa17d17 commit 35fcc0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ anyhow = "1.0.44"
async-trait = "0.1.51"
base64 = "0.13.0"
ecdsa = { version = "0.12.4", features = ["verify", "pem", "der", "pkcs8"] }
oci-distribution = { version = "0.7.0", default-features = false }
oci-distribution = { version = "0.8.1", default-features = false }
olpc-cjson = "0.1.1"
p256 = {version = "0.9.0", features = ["ecdsa-core"]}
serde_json = "1.0.68"
Expand Down
2 changes: 1 addition & 1 deletion src/cosign/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ mod tests {
let image = "docker.io/busybox:latest";
let image_digest =
String::from("sha256:f3cfc9d0dbf931d3db4685ec659b7ac68e2a578219da4aae65427886e649b06b");
let expected_image = "docker.io/busybox:sha256-f3cfc9d0dbf931d3db4685ec659b7ac68e2a578219da4aae65427886e649b06b.sig".parse().unwrap();
let expected_image = "docker.io/library/busybox:sha256-f3cfc9d0dbf931d3db4685ec659b7ac68e2a578219da4aae65427886e649b06b.sig".parse().unwrap();
let mock_client = MockOciClient {
fetch_manifest_digest_response: Some(Ok(image_digest.clone())),
pull_response: None,
Expand Down
3 changes: 3 additions & 0 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub struct ClientConfig {
pub protocol: ClientProtocol,

/// Accept invalid hostname. Defaults to false
#[cfg(feature = "native-tls")]
pub accept_invalid_hostnames: bool,

/// Accept invalid certificates. Defaults to false
Expand All @@ -125,6 +126,7 @@ impl Default for ClientConfig {
fn default() -> Self {
ClientConfig {
protocol: ClientProtocol::Https,
#[cfg(feature = "native-tls")]
accept_invalid_hostnames: false,
accept_invalid_certificates: false,
extra_root_certificates: Vec::new(),
Expand All @@ -137,6 +139,7 @@ impl From<ClientConfig> for oci_distribution::client::ClientConfig {
oci_distribution::client::ClientConfig {
protocol: oci_distribution::client::ClientProtocol::Https,
accept_invalid_certificates: config.accept_invalid_certificates,
#[cfg(feature = "native-tls")]
accept_invalid_hostnames: config.accept_invalid_hostnames,
extra_root_certificates: config
.extra_root_certificates
Expand Down

0 comments on commit 35fcc0f

Please sign in to comment.