Introduction¶
DSH (DeepSeek Harness) extends its capabilities via plugins, and subprocess environment handling can also be altered by plugins. By default, before creating a subprocess, DSH scrubs the parent process environment: variable names matching KEY, PASSWORD, SECRET, or TOKEN, as well as ambient DSH_* names are removed, and then entries from the explicit request are merged.
This reduces the flow of sensitive variables into subprocesses, but it may also prevent some local CLIs, scripts, or MCP servers from accessing the full environment of the current Harness process. zhangzujian/dsh-subprocess-inherit-environment is a removable DSH plugin prepared for this scenario: it deliberately passes the full Harness process environment to the subprocess via the ctx.subprocess service.
What is this¶
- Maintainer:
zhangzujian - License:
MIT - Repo name:
zhangzujian/dsh-subprocess-inherit-environment - NPM package name:
@zhangzujian/dsh-subprocess-inherit-environment - Core value: Allow callers who create subprocesses via
ctx.subprocessto inherit the fullprocess.env
It solves the problem of “subprocesses not getting the full environment” and is not a general-purpose environment variable management tool. It also will not affect code that bypasses ctx.subprocess and directly calls Node.js process APIs, worker APIs, or SDK-owned spawn.
Core Features¶
The plugin wraps the following operations of ctx.subprocess:
resolveExecutable(command, env, signal)
spawn(spec)
spawnTerminal(spec)
On every call, the plugin first expands based on the new process.env, generates an explicit environment layer, and then merges the environment variable entries provided by the caller. This way:
- The caller’s explicit overrides are preserved.
undefinedtombstones retain their original meaning.- The plugin does not modify the request object owned by the caller.
Compared to DSH’s default credential scrubbing, this plugin allows callers using the wrapped subprocess service to pass API keys, tokens, passwords, secrets, cookies, proxy credentials, and other environment values from the Harness process to the subprocess.
Installation and Removal¶
The method provided by the repository is to clone the repository first, then add the local directory to the DSH profile. Below are the installation steps for the web profile:
git clone https://github.com/zhangzujian/dsh-subprocess-inherit-environment.git
cd dsh-subprocess-inherit-environment
npx @deepseek-ai/dsh@0.1.0-rc.6 plugin --profile web add "$PWD"
If the current profile does not hot-load plugins, you need to restart DSH after adding.
Remove the plugin and restore DSH’s default credential scrubbing:
npx @deepseek-ai/dsh@0.1.0-rc.6 plugin --profile web remove @zhangzujian/dsh-subprocess-inherit-environment
You can also configure a local file URL overlay:
- insert:
- id: subprocess-inherit-environment
name: file:///absolute/path/to/dsh-subprocess-inherit-environment/index.mjs
Testing¶
Unit tests require Node.js 22 or higher:
npm test
Integration tests run against the installed DSH tree to verify original scrubbing, environment inheritance, and uninstallation recovery, and do not print any secret values:
DSH_INSTALL_DIR=/path/to/dsh/install npm run test:integration
Where DSH_INSTALL_DIR is the directory containing node_modules/@deepseek-ai.
Applicable Scenarios and Considerations¶
Suitable for:
- In dedicated, trusted local DSH deployments where it is explicitly required that subprocesses inherit the current Harness’s full environment.
- Certain local CLIs, repository scripts, package installers, or MCP servers need to read environment values from the current process.
- Source code and license have been checked before installation, and the scope of environment variables accessible to that DSH process can be controlled.
Not suitable for:
- Shared or untrusted Harness deployments.
- Scenarios requiring DSH’s default credential isolation.
- Scenarios where only a few precise variables are allowed to pass through, rather than inheriting the full
process.env.
Clearly assess the risks before using:
- The plugin disables DSH’s subprocess credential isolation.
- The plugin itself does not log environment names or values, but it does not prevent subprocesses from printing or transmitting these values.
- Model-generated commands, repository scripts, package installers, CLIs, MCP servers, and terminal programs may read or leak these environment values.
- When a dedicated tool or exact variable allowlist can be used, prioritize these narrower methods.
- The plugin runs with the permissions of the current
dshprocess; source code and theMITlicense should be checked before installation.
Uninstallation Behavior¶
After the plugin is removed, it first invalidates any installed wrappers; if the plugin still owns the corresponding method descriptors, it restores the previous method descriptors. Only one active installation is allowed on the same subprocess runtime; if there is already an active installation, a new installation will be rejected to avoid ambiguity in the uninstallation order.
Conclusion¶
The value of this plugin is specific: when DSH’s default environment scrubbing blocks certain local tools, it can be used to pass the full Harness environment transparently to subprocesses; the cost is reduced subprocess credential isolation, making it more suitable for dedicated deployments and controlled environments.
Repository URL:
https://github.com/zhangzujian/dsh-subprocess-inherit-environment
Directory Page (Standalone Site):
https://www.skillhub.cn/plugins/zhangzujian/dsh-subprocess-inherit-environment