Skip to content

Commit bc1f933

Browse files
authored
support insecure policy (#127)
Signed-off-by: Peter Bynum <pkpbynum@gmail.com>
1 parent e50fe41 commit bc1f933

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/imageproxy.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ pub struct ImageProxyConfig {
217217
/// If set, disable TLS verification. Equivalent to `skopeo --tls-verify=false`.
218218
pub insecure_skip_tls_verification: Option<bool>,
219219

220+
/// If set, disable signature verification. Equivalent to `skopeo --insecure-policy`.
221+
pub insecure_policy: Option<bool>,
222+
220223
/// Prefix to add to the user agent string. Equivalent to `skopeo --user-agent-prefix`.
221224
/// The resulting user agent will be in the format "prefix skopeo/version".
222225
/// This option is only used if the installed skopeo version supports it.
@@ -351,6 +354,10 @@ impl TryFrom<ImageProxyConfig> for Command {
351354
c.arg("--tls-verify=false");
352355
}
353356

357+
if config.insecure_policy.unwrap_or_default() {
358+
c.arg("--insecure-policy");
359+
}
360+
354361
// Add user agent prefix if provided and supported by skopeo
355362
if let Some(user_agent_prefix) = config.user_agent_prefix {
356363
if supports_user_agent_prefix() {
@@ -902,6 +909,13 @@ mod tests {
902909
.unwrap();
903910
validate(c, &[r"--tls-verify=false"], &[]);
904911

912+
let c = Command::try_from(ImageProxyConfig {
913+
insecure_policy: Some(true),
914+
..Default::default()
915+
})
916+
.unwrap();
917+
validate(c, &[r"--insecure-policy"], &[]);
918+
905919
let mut tmpf = cap_tempfile::TempFile::new_anonymous(tmpd).unwrap();
906920
tmpf.write_all(r#"{ "auths": {} "#.as_bytes()).unwrap();
907921
tmpf.seek(std::io::SeekFrom::Start(0)).unwrap();

0 commit comments

Comments
 (0)