fix(docker): reclaim sandbox token files on out-of-band removal - #3220
Open
letv1nnn wants to merge 1 commit into
Open
fix(docker): reclaim sandbox token files on out-of-band removal#3220letv1nnn wants to merge 1 commit into
letv1nnn wants to merge 1 commit into
Conversation
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
letv1nnn
marked this pull request as ready for review
September 8, 2026 16:51
letv1nnn
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
September 8, 2026 16:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
delete_sandbox_innerskipped per-sandbox token file cleanup on one exit path — Docker reports no container and no in-memory pending record survives — leaving the sandbox's gateway JWT on disk indefinitely. Every other exit path in that function already cleans up. This adds the missing call plus regression coverage.Related Issue
Fixes #3041
Changes
crates/openshell-driver-docker/src/lib.rs: callcleanup_sandbox_token_file_for_deletein the "container gone, no pending record" branch ofdelete_sandbox_inner._for_deleterather than_by_idbecause delete accepts a name with no id (require_sandbox_identifierrequires only one of the two). With an empty id,sandbox_token_pathresolves to<namespace>/sandbox.jwt, whose parent is the shared namespace directory._for_deleteguards on!sandbox_id.is_empty().Ok(false)return: nothing was removed from Docker, so no deletion is claimed and noDeletedwatch event fires.crates/openshell-driver-docker/src/tests.rs: two regression tests, plus a loopback stub that answers Docker'sGET /containers/jsonwith[]so the branch is reachable without a daemon.crates/openshell-driver-docker/Cargo.toml/Cargo.lock: enabletemp-env'sasync_closurefeature. The syncwith_varscannot wrap an async test body, and the tests needXDG_STATE_HOMEscoped to a tempdir.Left alone deliberately: the adjacent
summary_container_target→Nonebranch returnsOk(pending.is_some())without removing the container. That one is a live container being silently abandoned, not a token leak — adding cleanup there would revoke a running sandbox's credential. Worth its own issue;stop_sandbox_innerhandles the identical case withErr(Status::not_found).Testing
mise run pre-commitpassesChecklist