Skip to content

Commit 47d47af

Browse files
feloyjohntmyers
authored andcommitted
fix(podman): clean up proxy-auth secret when container already deleted
The delete_sandbox early-return path cleaned up the token secret but skipped the proxy-auth secret, leaking it on disk. Also update tests for recent API changes (Optional socket_path, workspace field, list-based container lookup). Signed-off-by: Philippe Martin <[email protected]> Signed-off-by: Philippe Martin <[email protected]>
1 parent 8ceea80 commit 47d47af

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎crates/openshell-driver-podman/src/driver.rs‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,11 @@ impl PodmanComputeDriver {
722722
}
723723
cleanup_sandbox_token_secret(&self.client, &container::token_secret_name(sandbox_id))
724724
.await;
725+
cleanup_sandbox_proxy_auth_secret(
726+
&self.client,
727+
&container::proxy_auth_secret_name(sandbox_id),
728+
)
729+
.await;
725730
return Ok(false);
726731
};
727732
info!(sandbox_id = %sandbox_id, container = %container_id, "Deleting sandbox container");
@@ -1608,7 +1613,7 @@ mod tests {
16081613

16091614
fn proxy_auth_config(socket_path: PathBuf, auth_file: &Path) -> PodmanComputeConfig {
16101615
PodmanComputeConfig {
1611-
socket_path,
1616+
socket_path: Some(socket_path),
16121617
stop_timeout_secs: 10,
16131618
proxy_auth_file: Some(auth_file.to_string_lossy().into_owned()),
16141619
proxy_auth_allow_insecure: Some(true),
@@ -1621,6 +1626,7 @@ mod tests {
16211626
id: id.to_string(),
16221627
name: name.to_string(),
16231628
namespace: String::new(),
1629+
workspace: String::new(),
16241630
spec: None,
16251631
status: None,
16261632
}
@@ -1722,18 +1728,16 @@ mod tests {
17221728
let (socket_path, request_log, handle) = spawn_podman_stub(
17231729
"delete-proxy-auth",
17241730
vec![
1725-
StubResponse::new(StatusCode::NOT_FOUND, r#"{"message":"gone"}"#), // inspect
1726-
StubResponse::new(StatusCode::NOT_FOUND, r#"{"message":"gone"}"#), // stop
1727-
StubResponse::new(StatusCode::NOT_FOUND, r#"{"message":"gone"}"#), // remove container
1728-
StubResponse::new(StatusCode::NO_CONTENT, ""), // remove volume
1731+
StubResponse::new(StatusCode::OK, "[]"), // list_containers (not found)
1732+
StubResponse::new(StatusCode::NO_CONTENT, ""), // remove volume
17291733
StubResponse::new(StatusCode::NO_CONTENT, ""), // remove token secret
17301734
StubResponse::new(StatusCode::NO_CONTENT, ""), // remove proxy-auth secret
17311735
],
17321736
);
17331737
let driver = test_driver(socket_path.clone());
17341738

17351739
driver
1736-
.delete_sandbox(sandbox_id, "demo")
1740+
.delete_sandbox(sandbox_id)
17371741
.await
17381742
.expect("delete should succeed");
17391743

0 commit comments

Comments
 (0)