Skip to content

fix(sandbox): block 'openclaw config set|unset' inside the sandbox#2081

Merged
cv merged 1 commit intomainfrom
fix/1973-block-openclaw-config-set
Apr 20, 2026
Merged

fix(sandbox): block 'openclaw config set|unset' inside the sandbox#2081
cv merged 1 commit intomainfrom
fix/1973-block-openclaw-config-set

Conversation

@laitingsheng
Copy link
Copy Markdown
Contributor

@laitingsheng laitingsheng commented Apr 20, 2026

Extend the nemoclaw-start configure guard to intercept 'openclaw config set' and 'openclaw config unset'. OpenClaw resolves its config path via $HOME, so inside the sandbox those writes land at /root/.openclaw/openclaw.json — a path no gateway reads — while the CLI still reports success and tells the user to restart the gateway. The guard surfaces the same actionable error already used for 'openclaw configure' and points users at 'nemoclaw onboard --resume'.

Read-only subcommands (get, list, show, view) are not matched and fall through to the real binary.

Closes #1973

Summary

Related Issue

Changes

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

AI Disclosure

  • AI-assisted — tool: Claude Code

Signed-off-by: Tinson Lai tinsonl@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Extended sandbox guard to prevent modification of configuration settings via openclaw config set and openclaw config unset commands. Users attempting these operations will receive clear instructions to exit the sandbox and resume onboarding.
  • Tests

    • Added comprehensive test suite to validate sandbox protection for configuration modification commands.

Extend the nemoclaw-start configure guard to intercept 'openclaw config set'
and 'openclaw config unset'. OpenClaw resolves its config path via $HOME, so
inside the sandbox those writes land at /root/.openclaw/openclaw.json — a
path no gateway reads — while the CLI still reports success and tells the
user to restart the gateway. The guard surfaces the same actionable error
already used for 'openclaw configure' and points users at
'nemoclaw onboard --resume'.

Read-only subcommands (get, list, show, view) are not matched and fall
through to the real binary.

Closes #1973

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 17ae0e9d-2212-40b1-a5de-d8cf46f8cee3

📥 Commits

Reviewing files that changed from the base of the PR and between 2a29b5e and 24999e7.

📒 Files selected for processing (2)
  • scripts/nemoclaw-start.sh
  • test/nemoclaw-start.test.ts

📝 Walkthrough

Walkthrough

The pull request extends the in-sandbox openclaw() guard function to intercept and block openclaw config set and openclaw config unset commands, emitting a read-only error and directing users to exit the sandbox. Read-only config operations pass through unblocked.

Changes

Cohort / File(s) Summary
Sandbox Guard Extension
scripts/nemoclaw-start.sh
Extended the openclaw() guard to add a config) case that matches set and unset subcommands, emitting a read-only/Landlock error and exiting with status 1, while allowing immutable config operations (get, list, show, view) to fall through to the actual openclaw command.
Test Coverage
test/nemoclaw-start.test.ts
Added new Vitest assertions validating the config) guard behavior: verifies error messaging includes the invoked subcommand, routes users to nemoclaw onboard --resume, returns exit code 1, and confirms read-only config operations bypass the guard.

Poem

🐰 A sandbox guard stands tall and true,
Blocking writes, letting safe reads through,
Config set and unset turn back with care,
While get and list roam free to share!

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: blocking 'openclaw config set|unset' commands inside the sandbox.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1973-block-openclaw-config-set

Comment @coderabbitai help to get the list of available commands and usage tips.

@cv cv merged commit 67db244 into main Apr 20, 2026
18 of 19 checks passed
ericksoa added a commit that referenced this pull request Apr 21, 2026
## Summary
- `export_gateway_token` and `install_configure_guard` write to
`.bashrc`/`.profile` but never lock them read-only afterward
- The Landlock policy declares `/sandbox` as `read_only`, but the files
retain default umask permissions (644), failing the
`04-landlock-readonly` E2E assertion
- Adds `chmod 444` after both write loops

## Test plan
- [ ] Nightly E2E `cloud-experimental-e2e` job passes
(04-landlock-readonly)

Fixes regression from #2081.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Shell configuration files are now set to read-only at the end of setup
steps (after gateway token injection and install/configure guard),
preventing accidental edits and ensuring configuration stability across
completion of the setup process.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
ericksoa pushed a commit that referenced this pull request Apr 21, 2026
## Summary

Catches up the user-facing reference and troubleshooting docs with the
CLI and policy behavior changes that landed in v0.0.21. Drafted via the
`nemoclaw-contributor-update-docs` skill against commits in
`v0.0.20..v0.0.21`, filtered through `docs/.docs-skip`.

## Changes

- **`docs/reference/commands.md`**
- `nemoclaw list`: session indicator (●) for connected sandboxes
(#2117).
- `nemoclaw <name> connect`: active-session note; auto-recovery from SSH
identity drift after a host reboot (#2117, #2064).
- `nemoclaw <name> status`: three-state Inference line (`healthy` /
`unreachable` / `not probed`) covering both local and remote providers;
new `Connected` line (#2002, #2117).
- `nemoclaw <name> destroy` and `rebuild`: active-session warning with
second confirm; rebuild reapplies policy presets to the recreated
sandbox (#2117, #2026).
- `nemoclaw <name> policy-add` and `policy-remove`: positional preset
argument and non-interactive flow via
`--yes`/`--force`/`NEMOCLAW_NON_INTERACTIVE=1` (#2070).
- `nemoclaw <name> policy-list`: registry-vs-gateway desync detection
(#2089).
- **`docs/reference/troubleshooting.md`**
- `Reconnect after a host reboot`: now reflects automatic stale
`known_hosts` pruning on `connect` (#2064).
- `Running multiple sandboxes simultaneously`: onboard's forward-port
collision guard (#2086).
- New section: `openclaw config set` or `unset` is blocked inside the
sandbox (#2081).
- **`docs/network-policy/customize-network-policy.md`**: non-interactive
`policy-add`/`policy-remove` form; preset preservation across rebuild
(#2070, #2026).
- **`docs/inference/use-local-inference.md`**: NIM section now covers
the NGC API key prompt with masked input and `docker login nvcr.io
--password-stdin` behavior (#2043).
- **Generated skills regenerated** to pick up the source changes
(`.agents/skills/nemoclaw-user-reference/references/{commands,troubleshooting}.md`,
plus minor heading-flow deltas elsewhere). The pre-commit `Regenerate
agent skills from docs` hook ran and confirmed source ↔ generated
parity.

Commits skipped per `docs/.docs-skip` or no doc impact: `bbbaa0fb`
(skip-features), `7cb482cb` (skip-features), `8dee23fd` (skip-terms),
plus the usual CI / test / refactor / install-plumbing churn.

## Type of Change

- [ ] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [x] Doc only (includes code sample changes)

## Verification

- [x] `npx prek run --all-files` passes for the modified files (the one
failing test, `test/cli.test.ts > unknown command exits 1`, also fails
on `origin/main` and is unrelated to these markdown-only changes)
- [ ] `npm test` passes — skipped; same pre-existing CLI-dispatch test
failure unrelated to docs
- [ ] Tests added or updated for new or changed behavior — n/a, doc-only
- [x] No secrets, API keys, or credentials committed
- [x] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only) — not run
locally
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)
— n/a, no new pages

## AI Disclosure

- [x] AI-assisted — tool: Claude Code

---
Signed-off-by: Miyoung Choi <miyoungc@nvidia.com>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Multi-session SSH connections with concurrent session support.
* Three-state inference health reporting (healthy/unreachable/not
probed) across all providers.
  * Automatic SSH host key rotation detection and recovery.
  * Non-interactive policy preset management via positional arguments.
  * Session indicators in sandbox list view.

* **Bug Fixes**
  * Protected destructive operations with active-session warnings.
  * Policy presets now preserved during sandbox rebuilds.

* **Documentation**
  * NGC registry authentication requirements for container images.
  * Multi-sandbox onboarding and reconnection guidance.
  * Troubleshooting updates for port conflicts and SSH issues.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

openclaw config set reports success but writes a stub file to /root/.openclaw/, not the gateway-visible /sandbox/.openclaw/openclaw.json

2 participants