Skip to content

fix: false error of Windows path when binding the host path to the sandbox.#42174

Open
6607changchun wants to merge 12 commits intoopenclaw:mainfrom
6607changchun:fix-windowsbind
Open

fix: false error of Windows path when binding the host path to the sandbox.#42174
6607changchun wants to merge 12 commits intoopenclaw:mainfrom
6607changchun:fix-windowsbind

Conversation

@6607changchun
Copy link
Copy Markdown

@6607changchun 6607changchun commented Mar 10, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: The drive letter of the path on Windows does not start with the slash, leading to false error of the sandbox security. So I added the passby branch to avoid it. When launching the gateway with the custom bindings on Windows, the drive letter is recoginzed as a relative path, leading to false error of the sand security.
  • Why it matters: This bug affects the usage of the custom binding features on Windows, which causes the custom binding feature to be completely unusable on Windows, as absolute Windows paths (e.g., D:/path) are incorrectly rejected by the security check.
  • What changed: Adding the branch of Windows path support to the sandbox security validation.
  • What did NOT change (scope boundary): The current permission check and the posix-like path validation are not changed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.
The host path on Windows can be binded to the sandbox.

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Windows 11 26200.7840
  • Runtime/container: Local Machine for the host, and Docker Desktop 4.34.3 with WSL2 backend for docker.
  • Model/provider: deepseek-V3.2 reasoner
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

"agents": {
    "defaults": {
      "sandbox": {
        "mode": "all",
        "scope": "session",
        "workspaceAccess": "ro",
        "docker": {
          "image": "192.168.1.102:8080/library/ubuntu:latest",
          "network": "bridge",
          "binds": ["D:/data/openclaw/src:/src:ro", "D:/data/openclaw/output:/output:rw"]
        }
      }
    }
  },
  1. Modify the openclaw.json like the above fragment.
  2. Launch the gateway

Expected

  • The gateway starts successfully, and the skills are able to executed in the docker container with proper binding.

Actual

  • The gateway fails to start.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

before

🦞 OpenClaw 2026.3.8 (3a12cf5) — One CLI to rule them all, and one more restart because you changed the port.


◇ Config ───────────────────────────────────────────────────╮
│ │
│ Config invalid; doctor will run with best-effort config. │
│ │
├────────────────────────────────────────────────────────────╯
Config invalid
File: ~.openclaw\openclaw.json
Problem:

  • agents.defaults.sandbox.docker.binds.0: Sandbox security: bind mount "D:/data/openclaw/src:/src:ro" uses a non-absolute source path "D". Only absolute POSIX paths are supported for sandbox binds.
  • agents.defaults.sandbox.docker.binds.1: Sandbox security: bind mount "D:/data/openclaw/output:/output:rw" uses a non-absolute source path "D". Only absolute POSIX paths are supported for sandbox binds.

Run: openclaw doctor --fix
Gateway aborted: config is invalid.
agents.defaults.sandbox.docker.binds.0: Sandbox security: bind mount "D:/data/openclaw/src:/src:ro" uses a non-absolute source path "D". Only absolute POSIX paths are supported for sandbox binds.
agents.defaults.sandbox.docker.binds.1: Sandbox security: bind mount "D:/data/openclaw/output:/output:rw" uses a non-absolute source path "D". Only absolute POSIX paths are supported for sandbox binds.
Fix the config and retry, or run "openclaw doctor" to repair.

after

🦞 OpenClaw 2026.3.8 (3a12cf5) — We ship features faster than Apple ships calculator updates.

Restarted Scheduled Task: OpenClaw Gateway

Human Verification (required)

What you personally verified (not just CI), and how: I put some files in the src directory, and then launched the gateway and tested the agent with several prompts. The agent successfully obtained these files and read the correct content of the files. Besides, I have checked the container, the src and output directory are correctly binded. The src directory is read-only and the output directory is read-write. The original permission check is not corrupted.

  • Verified scenarios: Agent successfully reads files from the read‑only /src directory. Agent writes files to the read‑write /output directory and the files persist on the host. Inside the container, /src is mounted as ro and /output as rw (confirmed via docker inspect). Bind mounts using D:/... syntax are accepted by the security validation and work as expected.
  • Edge cases checked:
  • What you did not verify: The regression testing of the original posix-like path validation as this patch is only a side-enhancement of the original conditions.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Directly revert this commit and reinstall.
  • Files/config to restore: None
  • Known bad symptoms reviewers should watch for: Windows paths of custom bindings will be rejected (if regression occurs)

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.
None

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Mar 10, 2026
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: 27f22a17dd

ℹ️ 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".

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 10, 2026

Greptile Summary

This PR attempts to fix a false-positive sandbox security error that rejects Windows-style drive-letter paths (e.g., D:/data/openclaw/src) as non-absolute paths when configuring Docker bind mounts on Windows.

What works:

  • The change to validate-sandbox-security.ts (getBlockedBindReason) is sound. It correctly delegates to the existing parseBindSourcePath utility and adds a Windows path check alongside the POSIX path check.

What is broken:

  • The change to zod-schema.agent-runtime.ts contains a critical bug in the colonCount loop (lines 151-156). The loop attempts to count colons by calling bind.indexOf(bindIndex) where bindIndex is a loop counter (number), which causes JavaScript to coerce it to a string and search for digit characters ("0", "1", etc.) rather than the ":" character. Combined with a type mismatch in the comparison (=== ':'), the loop always results in colonCount = 0, so the Windows path detection logic never activates. The source path is extracted as just "D", the regex test fails, and the original Zod validation error is still raised for Windows paths.

Secondary issue (both files):

  • Both modified files use /^[A-Z]:/ (uppercase-only) for Windows drive-letter detection, while the existing bind-spec.ts utility uses /^[A-Za-z]:[\\/]/ (case-insensitive). Lowercase drive letters like d:/path would still be rejected.

Result: The Zod validation layer (which produces the gateway-startup error users encounter) remains broken despite the attempted fix. Only the runtime enforcement path is improved.

Confidence Score: 1/5

  • Not safe to merge — the Zod config-validation layer (where the user-facing gateway-startup error originates) remains broken despite the attempted fix.
  • The critical issue is in zod-schema.agent-runtime.ts, which is the code path that produces the original error users reported. The colonCount loop contains compounding bugs that make it non-functional, so Windows paths will still fail Zod validation at gateway startup. While validate-sandbox-security.ts is correctly implemented, it only guards the runtime enforcement path, not the config-load-time validation that prevents the gateway from starting. The PR's stated goal (accepting Windows paths at config load time) is not achieved.
  • src/config/zod-schema.agent-runtime.ts — the colonCount logic must be rewritten or replaced with the existing splitSandboxBindSpec utility.

Last reviewed commit: 27f22a1

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: 1d49d4b883

ℹ️ 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".

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

ℹ️ 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".

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

ℹ️ 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".

@6607changchun
Copy link
Copy Markdown
Author

Oh no! Help!
I think that some previous merged PRs have corrupted the environment. The locations of the error log are never changed by my commits and there is no related issues with that in my commits.
I have no idea why this problems occur as the 2edab13 almost succeed except for the linter.

6607changchun and others added 8 commits March 10, 2026 23:05
…ndbox container.

The drive letter of the path in Windows does not start with the slash, leading to false error of the sandbox security. So I added the passby branch to avoid it.
replace with existing function

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
adding lowercase drive letter support

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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: ebb1b9dcde

ℹ️ 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".

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: 54eee3fbbd

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant