Repository navigation
Conversation
Greptile SummaryThis PR fixes a security classification bug in Confidence Score: 5/5Safe to merge — the reordering fix is correct, the new test validates the changed behavior, and no regressions are introduced. The change is small and surgical: a 4-line block moved 8 lines down. Both the old and new code always throw for dangerous binds; the only difference is the kind field, which is now accurate for Windows paths. The new test directly exercises the fixed path. No P0/P1 findings. No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4219d19d5
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| expect(getBlockedBindReason("C:\\Users\\tester\\.docker\\config.json:/mnt/test:ro")).toEqual( | ||
| expect.objectContaining({ | ||
| kind: "targets", | ||
| blockedPath: "C:/Users/tester/.docker", |
There was a problem hiding this comment.
Make Windows bind-path expectation platform-aware
This new assertion hard-codes blockedPath: "C:/Users/tester/.docker", but home roots are derived via resolveRequiredHomeDir(...)->path.resolve(...); on Linux/macOS, HOME="C:\\Users\\tester" resolves under the current working directory, so getBlockedBindReason(...) remains kind: "non_absolute" instead of targets. Since this test is unconditional, non-Windows CI lanes can fail even though the Windows-specific behavior is fine; gate this case to Windows or compute the expected path through the same normalization path used by production code.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0dedf04ea4
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kind: "targets", | ||
| blockedPath: "C:/Users/tester/.docker", | ||
| }), |
There was a problem hiding this comment.
Make Windows bind expectation platform-aware
This assertion assumes getBlockedBindReason will classify a Windows-style source as kind: "targets", but on non-Windows runners resolveRequiredHomeDir uses host path.resolve semantics, so HOME="C:\\Users\\tester" normalizes under the POSIX cwd and the bind remains kind: "non_absolute". That makes this test fail in Linux/macOS CI even though the Windows-specific behavior is fine; gate the case to Windows or derive the expected blocked path through the same normalization path used by production code.
Useful? React with 👍 / 👎.
0dedf04 to
f9e4715
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e40fc89dcb
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| expect(getBlockedBindReason("C:\\Users\\tester\\.docker\\config.json:/mnt/test:ro")).toEqual( | ||
| expect.objectContaining({ | ||
| kind: "targets", | ||
| blockedPath: "C:/Users/tester/.docker", | ||
| }), |
There was a problem hiding this comment.
Make Windows-home bind assertion host-aware
This assertion is not portable across CI hosts: when this test runs on Linux/macOS, the home roots are derived through host path.resolve, so a Windows-style HOME value like C:\Users\tester is resolved under the POSIX cwd and does not match C:/Users/tester/.docker, causing getBlockedBindReason(...) to return kind: "non_absolute" instead of targets. Fresh evidence: on Linux, path.resolve("C:\\Users\\tester") resolves to /workspace/openclaw/C:\\Users\\tester, which explains the mismatch. This makes the new regression test fail off Windows unless the expectation is gated by platform or computed via the same normalization path as production code.
Useful? React with 👍 / 👎.
b98b344 to
3b219e7
Compare
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-level. On current main, HOME pointing away from USERPROFILE leaves the raw USERPROFILE credential root out of blocked paths even though Windows drive-letter bind sources are accepted as absolute. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the narrow sandbox-only hardening after normal maintainer/security review, preserving Windows drive-letter bind support and the focused regression coverage. Do we have a high-confidence way to reproduce the issue? Yes, source-level. On current main, HOME pointing away from USERPROFILE leaves the raw USERPROFILE credential root out of blocked paths even though Windows drive-letter bind sources are accepted as absolute. Is this the best way to solve the issue? Yes. Adding raw USERPROFILE to the blocked-root candidates and cache key is the narrowest maintainable fix because it avoids changing global home-dir resolution and keeps ordinary drive-absolute Windows binds allowed. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 1d6e5f7a3e42. |
3b219e7 to
af28131
Compare
|
Reworked this PR after the ClawSweeper P1/P2 review. The branch is now rebuilt on current
Local validation: Result: Real behavior proof: {
"dangerous": {
"kind": "targets",
"blockedPath": "C:/Users/tester/.docker"
},
"driveAbsoluteAllowed": true
}That proof used Re-review progress:
|
…aw#63074) Adds Windows USERPROFILE to the sandbox blocked home roots so credential binds are denied even when HOME points at a different shell home. Verified: - node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts - node scripts/test-projects.mjs src/agents/sandbox/bind-spec.test.ts src/agents/sandbox/host-paths.test.ts src/agents/sandbox/validate-sandbox-security.test.ts - git diff --check HEAD^ HEAD Co-authored-by: luoyanglang <[email protected]>
… media - (#63074) Security/sandbox: include Windows USERPROFILE in blocked home roots. Thanks @luoyanglang. - Models config/auth: stop inferring providers from broad env-var name patterns; use structured SecretRefs only. Thanks @sallyom. - Media fetch: avoid buffering bodyless responses. Thanks @shakkernerd.
…aw#63074) Adds Windows USERPROFILE to the sandbox blocked home roots so credential binds are denied even when HOME points at a different shell home. Verified: - node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts - node scripts/test-projects.mjs src/agents/sandbox/bind-spec.test.ts src/agents/sandbox/host-paths.test.ts src/agents/sandbox/validate-sandbox-security.test.ts - git diff --check HEAD^ HEAD Co-authored-by: luoyanglang <[email protected]>
…aw#63074) Adds Windows USERPROFILE to the sandbox blocked home roots so credential binds are denied even when HOME points at a different shell home. Verified: - node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts - node scripts/test-projects.mjs src/agents/sandbox/bind-spec.test.ts src/agents/sandbox/host-paths.test.ts src/agents/sandbox/validate-sandbox-security.test.ts - git diff --check HEAD^ HEAD Co-authored-by: luoyanglang <[email protected]>
… media - (openclaw#63074) Security/sandbox: include Windows USERPROFILE in blocked home roots. Thanks @luoyanglang. - Models config/auth: stop inferring providers from broad env-var name patterns; use structured SecretRefs only. Thanks @sallyom. - Media fetch: avoid buffering bodyless responses. Thanks @shakkernerd.
…aw#63074) Adds Windows USERPROFILE to the sandbox blocked home roots so credential binds are denied even when HOME points at a different shell home. Verified: - node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts - node scripts/test-projects.mjs src/agents/sandbox/bind-spec.test.ts src/agents/sandbox/host-paths.test.ts src/agents/sandbox/validate-sandbox-security.test.ts - git diff --check HEAD^ HEAD Co-authored-by: luoyanglang <[email protected]>
… media - (openclaw#63074) Security/sandbox: include Windows USERPROFILE in blocked home roots. Thanks @luoyanglang. - Models config/auth: stop inferring providers from broad env-var name patterns; use structured SecretRefs only. Thanks @sallyom. - Media fetch: avoid buffering bodyless responses. Thanks @shakkernerd.
… media - (openclaw#63074) Security/sandbox: include Windows USERPROFILE in blocked home roots. Thanks @luoyanglang. - Models config/auth: stop inferring providers from broad env-var name patterns; use structured SecretRefs only. Thanks @sallyom. - Media fetch: avoid buffering bodyless responses. Thanks @shakkernerd.
…aw#63074) Adds Windows USERPROFILE to the sandbox blocked home roots so credential binds are denied even when HOME points at a different shell home. Verified: - node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts - node scripts/test-projects.mjs src/agents/sandbox/bind-spec.test.ts src/agents/sandbox/host-paths.test.ts src/agents/sandbox/validate-sandbox-security.test.ts - git diff --check HEAD^ HEAD Co-authored-by: luoyanglang <[email protected]>
… media - (openclaw#63074) Security/sandbox: include Windows USERPROFILE in blocked home roots. Thanks @luoyanglang. - Models config/auth: stop inferring providers from broad env-var name patterns; use structured SecretRefs only. Thanks @sallyom. - Media fetch: avoid buffering bodyless responses. Thanks @shakkernerd.
Summary
origin/mainas a narrow sandbox-only fixUSERPROFILEin blocked home credential roots/cache keys, so Windows credential binds are still blocked whenHOMEpoints elsewhereisSandboxHostPathAbsoluteas the absolute-path gateValidation
node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.tsResult on 2026-05-12 after rebasing onto
origin/main5abb4b18c8:Real behavior proof
Behavior or issue addressed: Windows
USERPROFILEcredential bind sources should be classified as blocked targets even whenHOMEpoints to a different directory, while ordinary drive-absolute Windows bind sources should remain allowed.Real environment tested: Local Linux checkout of OpenClaw on branch head
af28131360, Node/tsx runtime from the repository dependency set, after rebasing ontoorigin/main5abb4b18c8.Exact steps or command run after this patch: Ran a Node/tsx terminal probe that imported
getBlockedBindReasonandvalidateBindMountsfromsrc/agents/sandbox/validate-sandbox-security.ts, setHOME = "D:\\Users\\shell-home"andUSERPROFILE = "C:\\Users\\tester", then checked bothC:\\Users\\tester\\.docker\\config.json:/mnt/docker:roandD:/data/openclaw/src:/src:ro.Evidence after fix: Terminal output from the probe:
{ "dangerous": { "kind": "targets", "blockedPath": "C:/Users/tester/.docker" }, "driveAbsoluteAllowed": true }Observed result after fix: The dangerous Windows
USERPROFILEDocker credential bind was classified askind: "targets"with blocked pathC:/Users/tester/.docker, and the normal drive-absolute bind remained allowed.What was not tested: No live Windows Docker runtime was started; this proof exercises the sandbox bind classifier and validator directly in a local Node process.