dsh-unsandboxed-winbash: Provides DSH with unsandboxed Git Bash on Windows

Preface

On Linux and macOS, DeepSeek Harness (DSH) can provide bash to agents via dsh-tool-bash or dsh-bash-sandbox. On Windows, @deepseek-ai/dsh-base disables both of these tools; even if manually enabled, Git Bash (MSYS2) often fails to start inside the file sandbox — restricted tokens cannot create the named pipes required by MSYS signal handling. The result is that agents lack a usable Unix-style shell toolchain on Windows.

The community plugin dsh-unsandboxed-winbash (maintainer xswt442-cmd, category admin-security) addresses this limitation: it adds a winbash tool to the session that executes commands on the user’s self-installed Git for Windows, explicitly running outside the sandbox. The following sections cover its positioning, capabilities, installation, and security boundaries.

What Is This

dsh-unsandboxed-winbash is a DSH tool plugin exclusively for Windows (win32). It does not replace DSH’s built-in pwsh, fs, or permission-related services; it only adds a tool named winbash: it runs commands via Git Bash’s bash -c, fixes MSYS-related PATH issues, and returns stdout, stderr, and exit codes to the caller.

Both the npm package name and repository name are dsh-unsandboxed-winbash; the current package version is 0.1.7, licensed under MIT. DSH requires >=0.1.5-rc.3, Node.js requires >=20, and the runtime environment must also have Git for Windows (providing Git Bash) installed.

Why bash Is Not Available on Windows by Default

The README documents real tests inside a sandbox on Windows 11 + dsh 0.1.5-rc.1, where common attempts all failed:

Attempt Result
bash -c (PATH resolves to C:\Windows\System32\bash.exe) Bash/Service/CreateInstance/E_ACCESSDENIED
wsl.exe -e bash -c Wsl/Service/CreateInstance/E_ACCESSDENIED
C:\Program Files\Git\usr\bin\bash.exe -c fatal error - couldn't create signal pipe, Win32 error 5

Therefore, this plugin’s premise is: MSYS cannot start properly under an ACL-restricted token, so Git Bash must be spawned outside the file sandbox. The tool description will state this explicitly, and no sandbox_permissions escalation surface is provided.

Core Functionality

winbash Tool

  • Executes commands with bash -c, returning stdout, stderr, and exit codes; non-zero exits are reported as results, not as tool-layer errors.
  • Git Bash auto-discovery: prefers usr\bin\bash.exe (real MSYS2), then checks the bin\bash.exe wrapper; can also be explicitly specified via the bashPath configuration option.
  • PATH repair: prepends Git’s usr\bin, mingw64\bin, and cmd. Otherwise, under a typical Windows PATH containing only Git\cmd, commands like ls, grep, sed, awk, find, sleep, wc, etc. would fail with command not found.
  • Bounded output: retains a maxOutputBytes window; excess is written to a spill file and its path is provided in the result; multi-byte boundaries are not truncated into garbled characters.
  • Environment scrubbing: reuses scrubbedParentEnv from @deepseek-ai/dsh-subprocess, forwarding only dshEnv and variables required by Git; credential-type environment variables matching *KEY*, *TOKEN*, *SECRET*, *PASSWORD* are not passed to child processes.
  • Timeout and interruption: when timeoutMs / maxTimeoutMs expire or the call is aborted, performs taskkill /T /F on the process tree; settles on exit, with bounded stdio draining using drainMs.
  • Background tasks: supports run_in_background, using the host’s ctx.jobs registry, with incremental output reading.
  • Implementation-wise, commands explicitly invoke Git Bash internally — never bare bash — because on Windows bare bash may resolve to the WSL shim.

Relationship with Other Platforms

This plugin is not needed on non-win32 platforms: dsh-tool-bash and dsh-bash-sandbox are enabled by default on other platforms.

Installation and Activation

The package declares dsh.bundle; the bundle patch mounts the tool line automatically, so no manual editing of cordis.patch.yml is needed. A DSH Web restart is required after installation to take effect.

# Install from npm and register to web profile (recommended)
dsh plugin --profile web add dsh-unsandboxed-winbash

# Download the npm package only
npm install dsh-unsandboxed-winbash

# Or install from GitHub
dsh plugin --profile web add github:xswt442-cmd/dsh-unsandboxed-winbash

If the npm package is installed but not registered via dsh plugin, you need to complete the mounting yourself according to the DSH plugin documentation; the recommended path is to use the dsh plugin --profile web add command above.

Configuration

A tool-winbash node can be inserted in the Cordis patch, for example:

- insert:
    - id: tool-winbash
      name: dsh-unsandboxed-winbash/tool
      config:
        bashPath: ''          # Explicitly specify Git Bash path (default: auto-discovery)
        gitPathPrefix: true   # Prepend Git's usr\bin / mingw64\bin / cmd to PATH
        extraPath: ''         # Extra PATH prefixes, ';' separated (placed at the front)
        drainMs: 250          # Upper limit of waiting for output drain after child process exits
        timeoutMs: 120000     # Default command timeout
        maxTimeoutMs: 600000
        maxOutputBytes: 64000
        maxSpillBytes: 67108864
        enableRunInBackground: true

The Git Bash auto-discovery order is: %ProgramFiles%\Git\usr\bin\bash.exe → %ProgramFiles%\Git\bin\bash.exe → %LOCALAPPDATA%\Programs\Git\usr\bin\bash.exe → %ProgramFiles(x86)%\Git\.... If not found and bashPath is not configured, an error is only raised when winbash is invoked; the plugin mount itself will not fail.

Typical Usage

After installation and restarting DSH Web, the winbash tool appears in agent sessions. The model or workflow passes the shell snippet to execute in Git Bash through this tool (equivalent to bash -c "..."), and can then use common Unix commands under MSYS, provided Git for Windows is installed locally and its path is auto-discovered or specified in bashPath.

When restricted, auditable file read/write or modification is needed, you should still use DSH’s fs tool rather than expecting winbash to comply with file sandbox policies.

Applicable Scenarios and Notes

Who it’s for: Developer or operations scenarios on Windows running DSH Web or similar profiles, who want agents to execute Git Bash capabilities such as grep/sed/pipeline scripts, and who accept that “shell commands run outside the sandbox at the same permission level as the dsh process.”

Security and boundaries (must read):

  • Commands execute outside the file sandbox; pwsh, permission presets, /permission, and fs are still subject to their respective sandbox and approval policies.
  • The plugin runs with the current dsh process permissions; before installing, you should read the GitHub repository source code and MIT license to confirm compliance with your security policy.
  • On timeout or abort, the entire process tree is terminated; background tasks are cleaned up synchronously when the host exits.

The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub directory page is a community listing site with no official affiliation with DeepSeek / High-Flyer.

Links

  • Directory page: https://www.skillhub.cn/plugins/xswt442-cmd/dsh-unsandboxed-winbash
  • GitHub: https://github.com/xswt442-cmd/dsh-unsandboxed-winbash
  • npm: https://www.npmjs.com/package/dsh-unsandboxed-winbash

Following the steps above, on Windows you can complement DSH with a usable Git Bash toolchain while keeping sandbox capabilities like fs intact; whether to enable it depends on your acceptance of out-of-sandbox shells and your local Git installation.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye