Skip to content

fix(sandbox): block home credential binds#59157

Merged
eleqtrizit merged 3 commits intoopenclaw:mainfrom
eleqtrizit:257
Apr 3, 2026
Merged

fix(sandbox): block home credential binds#59157
eleqtrizit merged 3 commits intoopenclaw:mainfrom
eleqtrizit:257

Conversation

@eleqtrizit
Copy link
Copy Markdown
Contributor

Summary

  • Tightens sandbox bind validation for credential-bearing home-directory paths
  • Keeps the existing system-path denylist behavior unchanged outside those user credential roots

Changes

  • Added home-directory bind blocking for .aws, .cargo, .config, .docker, .gnupg, .netrc, .npm, and .ssh
  • Checked both the effective OpenClaw home and the OS home so overrides do not leave the real user credential paths unprotected
  • Added focused regression coverage for direct bind checks and validateBindMounts() enforcement

Validation

  • Ran corepack pnpm test -- src/agents/sandbox/validate-sandbox-security.test.ts
  • Ran PATH="/app/.local/bin:$PATH" corepack pnpm check
  • Ran PATH="/app/.local/bin:$PATH" claude -p "/review"; it exited without actionable code feedback in this environment after stopping on an approval prompt

Notes

  • Residual risk or follow-up: this change is intentionally limited to common credential-bearing home paths and does not broaden the reverted external bind-source policy

@eleqtrizit eleqtrizit requested a review from a team as a code owner April 1, 2026 16:56
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S r: too-many-prs Auto-close: author has more than twenty active PRs. labels Apr 1, 2026
@openclaw-barnacle
Copy link
Copy Markdown

Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

@openclaw-barnacle openclaw-barnacle Bot closed this Apr 1, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 1, 2026

Greptile Summary

This PR tightens sandbox bind validation by blocking eight credential-bearing home-directory subpaths (.aws, .cargo, .config, .docker, .gnupg, .netrc, .npm, .ssh) under both the effective OpenClaw home and the OS home directory, with symlink-resolution so alias paths cannot bypass the check. Test coverage is focused and well-structured, with proper afterEach(vi.unstubAllEnvs()) teardown.

Confidence Score: 5/5

Safe to merge; the security fix is correct and well-tested, with one minor documentation inaccuracy to clean up.

All findings are P2 (stale JSDoc claiming "no filesystem I/O" on getBlockedBindReason). The security logic is sound, both home roots are properly blocked, symlink aliases are resolved, and test coverage is comprehensive. No correctness or data-integrity issues found.

The JSDoc and inline comment on getBlockedBindReason in validate-sandbox-security.ts should be updated to remove the "no filesystem I/O" claim.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/sandbox/validate-sandbox-security.ts
Line: 104-117

Comment:
**Stale "no filesystem I/O" JSDoc contract**

The exported JSDoc on `getBlockedBindReason` explicitly states "String-only blocked-path check (no filesystem I/O)", but after this PR the function calls `getBlockedHostPaths()``getBlockedHomeRoots()``resolveSandboxHostPathViaExistingAncestor()` which in turn calls `fs.existsSync` and `fs.realpathSync` to canonicalize the home directory. The inline comment at the call-site in `validateBindMounts` ("Fast string-only check") has the same inaccuracy. Callers such as `src/security/audit-extra.sync.ts` happen to tolerate synchronous I/O, but the published contract is now wrong and will mislead future readers.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (4): Last reviewed commit: "fix(sandbox): harden blocked credential ..." | Re-trigger Greptile

Comment thread src/agents/sandbox/validate-sandbox-security.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52a4930ca4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/sandbox/validate-sandbox-security.ts
@eleqtrizit
Copy link
Copy Markdown
Contributor Author

@codex review

@eleqtrizit
Copy link
Copy Markdown
Contributor Author

@greptile review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@eleqtrizit eleqtrizit reopened this Apr 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added maintainer Maintainer-authored PR and removed r: too-many-prs Auto-close: author has more than twenty active PRs. labels Apr 3, 2026
@openclaw-barnacle
Copy link
Copy Markdown

Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

@openclaw-barnacle openclaw-barnacle Bot closed this Apr 3, 2026
@eleqtrizit eleqtrizit reopened this Apr 3, 2026
@eleqtrizit eleqtrizit merged commit ff607ad into openclaw:main Apr 3, 2026
9 checks passed
KimGLee pushed a commit to KimGLee/openclaw that referenced this pull request Apr 4, 2026
* fix(sandbox): block home credential binds
* fix(sandbox): harden blocked credential bind checks
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* fix(sandbox): block home credential binds
* fix(sandbox): harden blocked credential bind checks
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix(sandbox): block home credential binds
* fix(sandbox): harden blocked credential bind checks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix(sandbox): block home credential binds
* fix(sandbox): harden blocked credential bind checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant