Skip to content

fix(security): classify dangerous Windows sandbox binds first - #63074

Merged
BradGroux merged 1 commit into
openclaw:mainfrom
luoyanglang:wolf/windows-sandbox-bind-classification
May 13, 2026
Merged

BradGroux merged 1 commit into
openclaw:mainfrom
luoyanglang:wolf/windows-sandbox-bind-classification

Conversation

@luoyanglang

@luoyanglang luoyanglang commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • rebuild the PR on current origin/main as a narrow sandbox-only fix
  • include raw USERPROFILE in blocked home credential roots/cache keys, so Windows credential binds are still blocked when HOME points elsewhere
  • preserve current Windows drive-absolute bind support by keeping isSandboxHostPathAbsolute as the absolute-path gate
  • drop the stale Mattermost and publish-verification changes from the old branch

Validation

  • node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts

Result on 2026-05-12 after rebasing onto origin/main 5abb4b18c8:

Test Files  1 passed (1)
Tests       32 passed (32)

Real behavior proof

Behavior or issue addressed: Windows USERPROFILE credential bind sources should be classified as blocked targets even when HOME points 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 onto origin/main 5abb4b18c8.

Exact steps or command run after this patch: Ran a Node/tsx terminal probe that imported getBlockedBindReason and validateBindMounts from src/agents/sandbox/validate-sandbox-security.ts, set HOME = "D:\\Users\\shell-home" and USERPROFILE = "C:\\Users\\tester", then checked both C:\\Users\\tester\\.docker\\config.json:/mnt/docker:ro and D:/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 USERPROFILE Docker credential bind was classified as kind: "targets" with blocked path C:/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.

@luoyanglang
luoyanglang requested a review from a team as a code owner April 8, 2026 09:29
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Apr 8, 2026
@greptile-apps

greptile-apps Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a security classification bug in getBlockedBindReason: Windows credential paths such as C:\Users ester\.docker\config.json were previously short-circuited by the !sourceRaw.startsWith("/") guard and returned as kind: "non_absolute" before the blocked-path check ran. Moving that guard after getBlockedReasonForSourcePath means dangerous Windows home-credential binds are now correctly classified as kind: "targets". The new test covers the fixed case and the existing test's snapshot helper is updated for portability.

Confidence Score: 5/5

Safe 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.

Vulnerabilities

No new security concerns introduced. The PR closes a classification gap where Windows-style credential paths were misidentified as non_absolute instead of targets, ensuring consistent security enforcement across platforms.

Reviews (1): Last reviewed commit: "fix(security): classify dangerous Window..." | Re-trigger Greptile

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

Copy link
Copy Markdown
Contributor

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: 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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S and removed size: XS labels Apr 8, 2026

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment on lines +62 to +64
kind: "targets",
blockedPath: "C:/Users/tester/.docker",
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@luoyanglang
luoyanglang force-pushed the wolf/windows-sandbox-bind-classification branch from 0dedf04 to f9e4715 Compare April 8, 2026 11:45
@openclaw-barnacle openclaw-barnacle Bot added size: XS channel: mattermost Channel integration: mattermost scripts Repository scripts size: M and removed commands Command implementations size: S size: XS labels Apr 8, 2026

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

Copy link
Copy Markdown
Contributor

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: 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".

Comment on lines +60 to +64
expect(getBlockedBindReason("C:\\Users\\tester\\.docker\\config.json:/mnt/test:ro")).toEqual(
expect.objectContaining({
kind: "targets",
blockedPath: "C:/Users/tester/.docker",
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Apr 9, 2026
@luoyanglang
luoyanglang force-pushed the wolf/windows-sandbox-bind-classification branch from b98b344 to 3b219e7 Compare April 25, 2026 07:44
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Apr 25, 2026
@clawsweeper

clawsweeper Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
Adds raw USERPROFILE to sandbox blocked home-root cache/candidates and adds regression coverage for Windows credential binds when HOME points elsewhere.

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
Sufficient (terminal): The PR body includes after-fix terminal output from a Node/tsx probe against the real classifier and validator showing the USERPROFILE Docker credential bind blocked and a normal drive-absolute bind allowed.

Next step before merge
No ClawSweeper repair is needed; the branch already contains the narrow fix and sufficient proof, so the remaining action is normal maintainer/security review.

Security
Cleared: The diff tightens sandbox credential-bind classification and adds focused coverage without adding dependencies, workflows, release scripts, or new code-execution surface.

Review details

Best 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:

  • eleqtrizit: Authored the merged home credential bind blocking change that this PR extends to raw USERPROFILE roots. (role: introduced behavior; confidence: high; commits: ff607adc6974; files: src/agents/sandbox/validate-sandbox-security.ts, src/agents/sandbox/validate-sandbox-security.test.ts)
  • 6607changchun: Authored the merged Windows drive-letter sandbox bind support that this PR preserves while tightening credential classification. (role: introduced adjacent Windows behavior; confidence: high; commits: d02fbc6116ed; files: src/agents/sandbox/host-paths.ts, src/agents/sandbox/validate-sandbox-security.ts, src/agents/sandbox/validate-sandbox-security.test.ts)
  • BradGroux: Co-authored the merged Windows bind-path policy hardening and is connected to the broader Windows tracker referenced from this PR timeline. (role: adjacent Windows contributor; confidence: medium; commits: d02fbc6116ed; files: src/agents/sandbox/host-paths.ts, src/agents/sandbox/validate-sandbox-security.ts)
  • steipete: Recent sandbox validator/test commits touched the same blocked-path cache and assertion surface, making them a useful routing candidate for review. (role: recent area contributor; confidence: medium; commits: b5a16e263d52, 5967218cdffb; files: src/agents/sandbox/validate-sandbox-security.ts, src/agents/sandbox/validate-sandbox-security.test.ts)

Remaining risk / open question:

  • No live Windows Docker runtime was exercised in this review; the available proof directly exercises the sandbox classifier and validator path that the patch changes.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 1d6e5f7a3e42.

@luoyanglang
luoyanglang force-pushed the wolf/windows-sandbox-bind-classification branch from 3b219e7 to af28131 Compare May 12, 2026 11:53
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed channel: mattermost Channel integration: mattermost scripts Repository scripts size: M labels May 12, 2026
@luoyanglang

luoyanglang commented May 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Reworked this PR after the ClawSweeper P1/P2 review.

The branch is now rebuilt on current origin/main (5abb4b18c8) with a single narrow sandbox change at af28131360:

  • keeps current isSandboxHostPathAbsolute behavior, so non-dangerous Windows drive-letter binds still work
  • includes raw USERPROFILE in blocked home credential roots/cache keys
  • drops the stale Mattermost helper/policy and publish verification changes from the old branch

Local validation:

node scripts/test-projects.mjs src/agents/sandbox/validate-sandbox-security.test.ts

Result:

Test Files  1 passed (1)
Tests       32 passed (32)

Real behavior proof:

{
  "dangerous": {
    "kind": "targets",
    "blockedPath": "C:/Users/tester/.docker"
  },
  "driveAbsoluteAllowed": true
}

That proof used HOME = "D:\\Users\\shell-home", USERPROFILE = "C:\\Users\\tester", and checked C:\\Users\\tester\\.docker\\config.json:/mnt/docker:ro plus a normal D:/data/openclaw/src:/src:ro bind.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@BradGroux
BradGroux merged commit 609187f into openclaw:main May 13, 2026
127 of 140 checks passed
l3ocifer pushed a commit to l3ocifer/frack-openclaw that referenced this pull request May 13, 2026
…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]>
vincentkoc added a commit that referenced this pull request May 14, 2026
… 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.
@luoyanglang
luoyanglang deleted the wolf/windows-sandbox-bind-classification branch May 14, 2026 12:00
woodygreen pushed a commit to woodygreen/openclaw that referenced this pull request May 18, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
… 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.
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…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]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
… 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.
ericksoninco pushed a commit to ericksoninco/openclaw that referenced this pull request Jun 9, 2026
… 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.
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…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]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants