bug(driver-mxc): StopSandbox discards sandbox_id and can stop a same-named sandbox in another workspace
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 76/100
Piste de recherche
Commencez dans crates/openshell-driver-mxc/src/grpc.rs, au niveau de StopSandbox et GetSandbox, puis suivez backend stop_sandbox dans crates/openshell-driver-mxc/src/driver.rs. Utilisez comme contexte le test de nommage limité au workspace dans crates/openshell-server/src/persistence/tests.rs et exécutez les tests Rust pertinents. C’est terminé lorsque les arrêts avec portée d’ID ne peuvent pas cibler un autre sandbox portant le même nom, que les arrêts ambigus fondés uniquement sur le nom échouent de manière déterministe et que DeleteSandbox a été audité.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
User Story
As an operator running sandboxes across multiple workspaces on the MXC driver, I want a stop request to act on exactly the sandbox the gateway identified, so that stopping a sandbox in one workspace never interrupts an unrelated sandbox that happens to share its name.
Problem Statement
StopSandbox on the MXC driver discards the sandbox_id it receives and resolves the target by name alone.
crates/openshell-driver-mxc/src/grpc.rs:124-128:
if req.sandbox_name.is_empty() {
return Err(Status::invalid_argument("sandbox_name is required"));
}
self.backend.stop_sandbox(&req.sandbox_name).await?;
req.sandbox_id is never read. The backend then resolves by name (crates/openshell-driver-mxc/src/driver.rs:441):
let entry = registry
.values()
.find(|entry| entry.sandbox.name == sandbox_name)
.ok_or_else(|| tonic::Status::not_found(format!("sandbox {sandbox_name} not found")))?;
Nothing verifies afterward that the resolved entry is the one the request named.
Sandbox names are unique per workspace, not globally (crates/openshell-server/src/persistence/tests.rs:684, sqlite_name_unique_scoped_by_workspace), so two sandboxes in different workspaces can legitimately share a name. The MXC registry permits this: create_sandbox rejects duplicates by id only (driver.rs:389), never by name. With two same-named entries present, HashMap::values().find(...) picks one by iteration order.
The driver already carries the information needed to disambiguate — SandboxEntry.sandbox.workspace is populated (driver.rs:877) — and the same file already demonstrates the missing guard. GetSandbox performs a post-resolution id check (grpc.rs:90):
if !req.sandbox_id.is_empty() && req.sandbox_id != sandbox.id {
return Err(Status::failed_precondition("sandbox_id did not match the fetched sandbox"));
}
StopSandbox has no equivalent.
Impact / Why This Matters
The gateway always sends a valid sandbox_id on StopSandbox, so this misfires on ordinary traffic — no restart, retry, or unusual state is required. An operator stopping demo in one workspace can silently stop demo in another, terminating a live workload with no error surfaced to either caller. Which sandbox is hit depends on hash iteration order, so the failure is not reproducible run to run.
There is no workaround available to the caller: the request already carries the correct id and the driver ignores it. Avoiding the bug requires never reusing a sandbox name across workspaces on an MXC gateway, which contradicts the workspace-scoped naming the rest of the product guarantees.
Related: #3234 and #3240 address the same class of defect in the Docker driver.
Acceptance Criteria
-
StopSandboxresolves the target usingsandbox_idwhen the request supplies one, and does not fall back to the name in that case. - A stop request carrying a valid
sandbox_idnever acts on a different sandbox that shares thesandbox_name. - A name-only stop request that matches more than one sandbox fails with a deterministic error instead of selecting one by iteration order.
- Regression tests cover: id-scoped stop with two same-named sandboxes in different workspaces stops only the requested one; ambiguous name-only stop is rejected.
-
DeleteSandboxon the same driver is audited for the same weakness (grpc.rs:145-155forwards both fields; its backend path was not traced during this investigation).
Reproduction Steps
Code inspection; not reproduced against a running MXC gateway (Windows-only driver).
- Create workspaces
alphaandbetaon a gateway using the MXC compute driver. - Create a sandbox named
demoinalpha, and another nameddemoinbeta. Both are accepted — names are unique per workspace, and the MXC registry rejects duplicates by id only. - Issue
StopSandboxfor thedemoinbeta. The gateway sends both that sandbox's id and the namedemo. - Observe that the driver ignores the id and resolves
demoby name, so the sandbox stopped may be the one inalpha.
Environment
- OpenShell:
mainata0814443 - OS: Windows (MXC driver is Windows-only)
- Runtime, deployment, or integration: MXC compute driver, gateway with more than one workspace
- Langage dominant
- Rust
- Étoiles
- 15.4k
- Forks
- 1.7k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 347
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NVIDIA/OpenShell
-
state:triage-needed
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
Les mainteneurs répondent en général sous 1 jour
-
state:triage-needed
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
docs: document workspace and provider label capabilitiesPeut-être pris @johntmyers l’a pris il y a 5 jours. Ouvertearea:docs
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
NVIDIA/OpenShell#4250 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug(driver-mxc): test helper fails to compile after gateway-name argumentPeut-être pris @feloy l’a pris il y a 7 jours. Ouvertestate:triage-needed
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
bug: install.sh ignores XDG_CONFIG_HOME for the local gateway configPeut-être pris @fede-kamel l’a pris il y a 10 jours. Ouvertearea:cli os:linux os:macos state:validated
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
NVIDIA/OpenShell#4042 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de NVIDIA/OpenShell
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
swc-project/swc#12516 ·
Les mainteneurs répondent en général sous 1 jour
-
mls-rs-crypto-awslc: exact aws-lc-rs =1.16.3 pin blocks rustls security updatePeut-être pris @muscariello l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
[work-item] adam-adae-worsening-emergence: conform spec.yaml to the specification style contract (REQ-1280)Peut-être pris @muse-yamaa-bot l’a pris aujourd’hui. Ouvertework-item
Difficulté 1/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Possible memory leak: message iterators from pactffi_pact_handle_get_*message_iter are never deletedOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
pact-foundation/pact-go#652 ·
Les mainteneurs répondent en général sous 1 jour