You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bb8ba78
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(security): isolate gateway process from sandbox agent (#721)
* fix(install): prevent nvm/login shell from resetting PATH in subshells
Two issues caused install_nemoclaw() subshells to lose the caller's
PATH, making install-preflight tests fail on macOS while passing in CI:
1. `bash -lc` sourced /etc/profile which runs path_helper on macOS,
resetting PATH to system defaults and hiding the caller's binaries.
Fix: replace `bash -lc` with `bash -c` — the parent shell already
has the correct PATH, so a login shell is unnecessary.
2. `ensure_nvm_loaded()` unconditionally sourced nvm.sh, which also
resets PATH. Fix: skip sourcing when node is already on PATH.
Also export `info` and `warn` helpers via `declare -f` so
pre_extract_openclaw can use them in the subshell.
Additionally:
- Fix SC2206 shellcheck warning in version_gte() by using `read -ra`
instead of unquoted word splitting into arrays.
- Add .shellcheckrc to suppress SC2059 (printf format string with color
vars) and SC1091 (dynamically sourced files) across the project.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(ci): drop stray '.' arg from pyright pre-push hook
Passing '.' to pyright overrides the include/exclude paths in
pyproject.toml, causing it to scan .venv and test files. Without the
argument, pyright respects the configured include paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* chore: apply shfmt formatting to shell scripts
Auto-formatted by shfmt via pre-commit hooks after merging
upstream/main.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(ci): exclude test files from pyright strict type-checking
The test_endpoint_validation.py file imports pytest which is only
available as a dev dependency. Pyright in strict mode cannot resolve it,
breaking the pre-push hook. Exclude test files from pyright's include
paths since they have their own type discipline via pytest.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(ci): drop stray '.' arg from pyright in blueprint Makefile
Same issue as the pre-commit hook fix — passing '.' to pyright
overrides the include/exclude paths in pyproject.toml, causing it to
scan .venv and site-packages (17k+ errors in CI).
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(security): isolate gateway process from sandbox agent
The sandboxed agent could bypass config immutability by creating a
copy of openclaw.json in a writable directory, modifying auth tokens
and CORS origins, then killing the gateway and restarting it with
HOME pointing to the tampered config. This was publicly demonstrated
and is being actively discussed.
Fix: run the gateway as a dedicated 'gateway' user via gosu. The
'sandbox' user (agent) cannot kill processes owned by a different UID.
The fake-HOME attack no longer works because the agent cannot restart
the gateway.
Additional defense-in-depth:
- Pin config hash at build time (sha256sum), verify at startup
- Entrypoint runs as root, drops to gateway/sandbox as appropriate
- gosu for clean privilege separation (no shell, no env leakage)
* chore: apply shfmt formatting to brev-setup.sh
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(security): harden entrypoint against symlink injection, PATH hijacking, and log tampering
Additional mitigations beyond gateway process isolation:
- Lock PATH to system dirs at entrypoint start
- Resolve openclaw binary path once, pass as absolute path to auto-pair
- Verify .openclaw symlinks point to expected targets at startup
- Protect gateway log (chown gateway, chmod 600)
- Change .openclaw dir from 1777 to 755 (prevents symlink replacement)
* fix(security): pin apt and pip package versions in Dockerfile
Addresses hadolint DL3008, DL3013, DL3042, and DL3059: pin all apt
packages to exact versions, pin pyyaml, add --no-cache-dir, and
consolidate consecutive RUN instructions.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: address CodeRabbit review feedback on gateway isolation
- Use separate /tmp/auto-pair.log for the auto-pair watcher (runs as
sandbox user) instead of appending to /tmp/gateway.log which is owned
by gateway:gateway with mode 600 — fixes permission denied on write.
- Wait on GATEWAY_PID at end of entrypoint so PID 1 stays alive and
Docker does not terminate the container immediately after launch.
* test: add E2E test for gateway process isolation (10 checks)
Builds the sandbox image and verifies:
1. Gateway and sandbox are different UIDs
2. openclaw.json not writable by sandbox
3. Symlinks in .openclaw cannot be replaced by sandbox
4. Config hash exists and matches
5. Config hash not writable by sandbox
6. gosu installed
7. PATH locked in entrypoint
8. openclaw resolved to absolute path
9. Symlink verification present
10. Sandbox user cannot kill gateway-user processes
Added as test-e2e-gateway-isolation parallel CI job in pr.yaml.
* fix: remove hadolint ignore and quote pyyaml version pin
Remove stale DL3008 suppression (versions are pinned) and add quotes
around the pyyaml version specifier for consistency with upstream.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: prevent infinite recursion when openshell passes nemoclaw-start as command arg
* fix: document -h short alias in usage output
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: suppress hadolint DL3002 — root USER is intentional for gosu privilege separation
* chore: consolidate apt-get layers (merge gosu into main install)
* fix: address review feedback on gateway isolation PR
- Pin gosu=1.14-1+b10 in Dockerfile
- Remove dead setfacl ACL lines (acl package not installed)
- Fail closed on missing config hash file instead of warn-and-continue
- Only strip nemoclaw-start from $1, not all arg positions
- Capture Docker build output on failure instead of /dev/null
- Replace grep-based tests 7-9 with behavioral assertions
- Share single Docker image build across both e2e CI jobs
* ci: allow 'merge' type in commitlint config
Merge commits from conflict resolution use the 'merge:' prefix,
which was not in the allowed type list, causing commit-lint CI to fail.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: add hadolint ignore for intentional root USER and fix CI image builds
- Add hadolint DL3002 ignore on USER root (intentional for config locking)
- Build both test and production Docker images in CI: sandbox-test for
e2e fixtures, production for gateway isolation tests
* fix: resolve remaining CI failures and address symlink review comment
- Move hadolint DL3002 ignore to directly before USER root (fixes lint)
- Rebase test/Dockerfile.sandbox on the production image instead of
rebuilding from scratch — shares the build-sandbox-image artifact
while layering test fixtures on top (fixes test-e2e-sandbox)
- Verify all symlinks in .openclaw dynamically instead of hardcoding
a fixed list, so future OpenClaw symlinks are covered automatically
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* chore: apply shfmt formatting
* fix: upgrade gosu from 1.14 (Debian bookworm) to 1.19 (2025-09)
Install gosu directly from GitHub release with SHA-256 checksum
verification instead of Debian bookworm's 5-year-old apt package.
* fix: add hadolint DL4006 ignore for gosu checksum pipe
* fix: apply shfmt indent to case pattern in nemoclaw-start
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* chore: re-sign with verified SSH key
---------
Co-authored-by: Carlos Villela <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
0 commit comments