Skip to content

fix: validate and quote sandbox name in shell commands#170

Merged
jacobtomlinson merged 3 commits intomainfrom
fix/quote-sandbox-name-onboard
Mar 17, 2026
Merged

fix: validate and quote sandbox name in shell commands#170
jacobtomlinson merged 3 commits intomainfrom
fix/quote-sandbox-name-onboard

Conversation

@ericksoa
Copy link
Copy Markdown
Contributor

@ericksoa ericksoa commented Mar 17, 2026

Summary

Closes #166, closes #202

Two sandbox name issues:

  1. Unquoted ${sandboxName} in shell commands across onboard.js, policies.js, and nemoclaw.js caused argument parsing failures
  2. Capital letters in sandbox names caused Kubernetes rejection (RFC 1123 requires lowercase)

Changes:

  • Auto-lowercase and .trim() the sandbox name from user input
  • Validate against RFC 1123 subdomain rules (/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/)
  • Prompt now shows the naming rules
  • Quoted ${sandboxName} in all shell commands across 3 files (onboard.js, policies.js, nemoclaw.js)
  • Clear error message on invalid names

Test results

Validation logic (23 assertions, 0 failures)

Input Expected Result
My-Assistant auto-lower → my-assistant, valid PASS
ALLCAPS auto-lower → allcaps, valid PASS
TestBox auto-lower → testbox, valid PASS
my-assistant valid PASS
sandbox1 valid PASS
a valid PASS
a-b-c valid PASS
my-assistant trimmed, valid PASS
"" (empty) rejected PASS
" " (whitespace) rejected PASS
-start rejected (starts with hyphen) PASS
end- rejected (ends with hyphen) PASS
has_underscore rejected (not RFC 1123) PASS
has space rejected PASS
semi;colon rejected PASS
$(whoami) rejected (shell injection) PASS
null / undefined rejected (empty) PASS

Real openshell E2E

Input TestCaps at the sandbox name prompt → auto-lowered to testcaps → sandbox created successfully on real openshell. On main without this fix, the same input produces a Kubernetes RFC 1123 error.

Shell command quoting sweep (0 unquoted)

grep -rn 'run(' bin/ --include='*.js' | grep sandboxName | grep -v '"${sandboxName}"' returns zero matches across onboard.js, policies.js, and nemoclaw.js.

E2E inference

Sandbox created on this branch, provider configured, agent prompt sent to Nemotron 3 Super 120B through real OpenShell gateway → response received.

ericksoa and others added 3 commits March 17, 2026 06:15
Sandbox name from user prompt was interpolated unquoted into openshell
commands, causing failures when the name contained spaces or unexpected
input. Added name validation (alphanumeric, hyphens, underscores only)
and quoted all sandbox name interpolations in shell commands.

Closes #166

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The initial commit missed 5 unquoted ${sandboxName} interpolations in
bin/nemoclaw.js (sandboxConnect, sandboxStatus, sandboxLogs,
sandboxDestroy). These have the same shell injection / argument parsing
vulnerability as the onboard.js ones fixed in the previous commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sandbox creation failed with capital letters because Kubernetes requires
RFC 1123 subdomains (lowercase alphanumeric + hyphens, must start/end
with alphanumeric). Now the name is auto-lowercased and the prompt
shows the naming rules.

Closes #202
@jacobtomlinson jacobtomlinson self-requested a review March 17, 2026 17:39
@jacobtomlinson jacobtomlinson merged commit 4013dca into main Mar 17, 2026
brianwtaylor added a commit to brianwtaylor/NemoClaw that referenced this pull request Mar 21, 2026
Extends the RFC 1123 validation and double-quoting pattern from NVIDIA#170
(sandbox names) to the deploy() function. All 7 unquoted ${name}
interpolations in ssh/scp/rsync commands are now quoted, and instance
names are validated at entry to prevent command injection.
brianwtaylor added a commit to brianwtaylor/NemoClaw that referenced this pull request Mar 21, 2026
Extends the RFC 1123 validation and double-quoting pattern from NVIDIA#170
(sandbox names) to the deploy() function. All 7 unquoted ${name}
interpolations in ssh/scp/rsync commands are now quoted, and instance
names are validated at entry to prevent command injection.
brianwtaylor added a commit to brianwtaylor/NemoClaw that referenced this pull request Mar 21, 2026
Extends the RFC 1123 validation and double-quoting pattern from NVIDIA#170
(sandbox names) to the deploy() function. All 7 unquoted ${name}
interpolations in ssh/scp/rsync commands are now quoted, and instance
names are validated at entry to prevent command injection.
brianwtaylor added a commit to brianwtaylor/NemoClaw that referenced this pull request Mar 21, 2026
Extends the RFC 1123 validation and double-quoting pattern from NVIDIA#170
(sandbox names) to the deploy() function. All 7 unquoted ${name}
interpolations in ssh/scp/rsync commands are now quoted, and instance
names are validated at entry to prevent command injection.
Ryuketsukami pushed a commit to Ryuketsukami/NemoClaw that referenced this pull request Mar 24, 2026
* fix: validate and quote sandbox name in shell commands

Sandbox name from user prompt was interpolated unquoted into openshell
commands, causing failures when the name contained spaces or unexpected
input. Added name validation (alphanumeric, hyphens, underscores only)
and quoted all sandbox name interpolations in shell commands.

Closes NVIDIA#166

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: also quote sandbox name in bin/nemoclaw.js shell commands

The initial commit missed 5 unquoted ${sandboxName} interpolations in
bin/nemoclaw.js (sandboxConnect, sandboxStatus, sandboxLogs,
sandboxDestroy). These have the same shell injection / argument parsing
vulnerability as the onboard.js ones fixed in the previous commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: auto-lowercase sandbox names and enforce RFC 1123 rules

Sandbox creation failed with capital letters because Kubernetes requires
RFC 1123 subdomains (lowercase alphanumeric + hyphens, must start/end
with alphanumeric). Now the name is auto-lowercased and the prompt
shows the naming rules.

Closes NVIDIA#202

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jessesanford pushed a commit to jessesanford/NemoClaw that referenced this pull request Mar 24, 2026
* fix: validate and quote sandbox name in shell commands

Sandbox name from user prompt was interpolated unquoted into openshell
commands, causing failures when the name contained spaces or unexpected
input. Added name validation (alphanumeric, hyphens, underscores only)
and quoted all sandbox name interpolations in shell commands.

Closes NVIDIA#166

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: also quote sandbox name in bin/nemoclaw.js shell commands

The initial commit missed 5 unquoted ${sandboxName} interpolations in
bin/nemoclaw.js (sandboxConnect, sandboxStatus, sandboxLogs,
sandboxDestroy). These have the same shell injection / argument parsing
vulnerability as the onboard.js ones fixed in the previous commit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: auto-lowercase sandbox names and enforce RFC 1123 rules

Sandbox creation failed with capital letters because Kubernetes requires
RFC 1123 subdomains (lowercase alphanumeric + hyphens, must start/end
with alphanumeric). Now the name is auto-lowercased and the prompt
shows the naming rules.

Closes NVIDIA#202

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mafueee pushed a commit to mafueee/NemoClaw that referenced this pull request Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sandbox creation failed when name has capital letters. Sandbox name not quoted in shell commands in onboard.js

2 participants