Skip to content

fix: quote sandbox names in shell commands to prevent truncation#90

Closed
WuKongAI-CMU wants to merge 1 commit intoNVIDIA:mainfrom
WuKongAI-CMU:fix/quote-sandbox-names
Closed

fix: quote sandbox names in shell commands to prevent truncation#90
WuKongAI-CMU wants to merge 1 commit intoNVIDIA:mainfrom
WuKongAI-CMU:fix/quote-sandbox-names

Conversation

@WuKongAI-CMU
Copy link
Copy Markdown
Contributor

Summary

  • Quote all sandboxName interpolations in shell commands (openshell sandbox delete, sandbox create --name, forward start, policy get, policy set) to prevent word-splitting truncation
  • Add validateSandboxName() that rejects names with shell metacharacters or argument-injection patterns before they reach any command
  • Add 7 regression tests covering hyphenated names (WSL), metacharacter rejection, and argument injection prevention

Fixes #21 — WSL sandbox name truncation where my-assistant becomes m
Fixes #46 — DGX Spark step 7/7 failure where openshell policy set receives unexpected mkdir argument due to unquoted name

Root cause

All openshell commands in onboard.js and policies.js interpolated ${sandboxName} without shell quotes into strings executed via bash -c. On WSL and other environments with different argument-parsing behavior, hyphens or special characters caused word splitting.

Test plan

  • All 17 existing + new tests pass (node --test test/sandbox-name.test.js test/policies.test.js)
  • Verify onboarding with hyphenated sandbox name on WSL
  • Verify policy preset application completes on DGX Spark

🤖 Generated with Claude Code

On WSL and certain shell environments, unquoted sandbox names containing
hyphens (e.g., "my-assistant") can be truncated or split by word splitting
when passed to openshell commands via bash -c. This caused policy set to
receive a single character instead of the full name (Fixes NVIDIA#21), and
contributed to the unexpected 'mkdir' argument error on DGX Spark (NVIDIA#46).

Changes:
- Quote all sandbox name interpolations in openshell commands
  (sandbox delete, sandbox create --name, forward start, policy get, policy set)
- Add validateSandboxName() to reject names with shell metacharacters
  or argument-injection patterns before they reach any command
- Add regression tests for name validation including WSL-style hyphenated names

Fixes NVIDIA#21
Fixes NVIDIA#46

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: peteryuqin <peter.yuqin@gmail.com>
@WuKongAI-CMU
Copy link
Copy Markdown
Contributor Author

Closing to reduce my open PR count below the repo policy limit and refocus on a smaller set of higher-signal changes. I can revive this branch later if it becomes the right path again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant