fix(driver-vm): make sandbox_id authoritative and reject ambiguous name lookups - #3302
Closed
rksharma-owg wants to merge 1 commit into
Closed
fix(driver-vm): make sandbox_id authoritative and reject ambiguous name lookups#3302rksharma-owg wants to merge 1 commit into
rksharma-owg wants to merge 1 commit into
Conversation
…me lookups Fixes NVIDIA#3254 Signed-off-by: RKS <rajesh.sharma@owasp.org>
rksharma-owg
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
September 13, 2026 18:54
|
Thank you for your interest in contributing to OpenShell, @rksharma-owg. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
|
All contributors have signed the DCO ✍️ ✅ |
Author
|
I have read the DCO document and I hereby sign the DCO. |
Author
|
Vouch request submitted in #3303. This PR will be reopened once approved by a maintainer. |
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
Lifecycle requests (
stop_sandbox,start_sandbox,delete_sandbox) in the VM compute driver fell back to searching bysandbox_namewhenever the suppliedsandbox_idwas missing or not found in the in-memory registry. Because sandbox names are unique per workspace rather than globally, and the driver request carries no workspace identifier, a prune sweep or lifecycle request with a missing or stalesandbox_idcould resolve to a same-named sandbox in another workspace, chosen byHashMapiteration order.This change introduces
resolve_registry_id(mirroringresolve_pending_idfrom Docker driver fix #3240), makingsandbox_idauthoritative, eliminating the cross-workspace name fallback when an id is supplied, rejecting ambiguous name-only requests withFailedPrecondition, and scoping the create-time duplicate name check by workspace.Related Issue
Fixes #3254
Changes
crates/openshell-driver-vm/src/driver.rs:resolve_registry_idhelper:sandbox_idis authoritative: if non-empty, checks presence in the registry and never consultssandbox_nameas a fallback.sandbox_idis empty, resolves bysandbox_name. Rejects multiple matches across workspaces withFailedPrecondition("sandbox_name matches multiple sandboxes; specify sandbox_id")instead of non-deterministic hash iteration.stop_sandbox: replaced inline fallback withresolve_registry_id.start_sandbox: replaced inline fallback withresolve_registry_id.delete_sandbox: replaced inline fallback withresolve_registry_id.create_sandbox: scoped duplicate name check torecord.snapshot.name == sandbox.name && record.snapshot.workspace == sandbox.workspacein addition to uniquesandbox.id.resolve_registry_id_prefers_sandbox_id_over_sandbox_name.resolve_registry_id_ignores_the_name_when_the_id_is_not_registered.resolve_registry_id_falls_back_to_the_name_when_no_id_is_supplied.resolve_registry_id_rejects_an_ambiguous_name_only_lookup.resolve_registry_id_returns_none_without_any_identifier.duplicate_create_with_same_name_in_same_workspace_fails.Testing
cargo check -p openshell-driver-vmpassescargo test -p openshell-driver-vm --lib resolve_registry_idpasses (5/5)cargo test -p openshell-driver-vm --lib duplicate_createpasses (2/2)cargo test -p openshell-driver-vm --lib lifecyclepasses (14/14)Checklist