插件目录 / Developer / dsh-subprocess-inherit-environment
dsh-subprocess-inherit-environment
已验证 · 实测可装 zhangzujian
功能简介
通过ctx.subprocess转发完整Harness环境
可用 — 实测通过,早期项目
通过ctx.subprocess转发完整Harness环境 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-subprocess-inherit-environment
A removable DeepSeek Harness / DSH plugin that deliberately forwards the
Harness process's complete environment through the ctx.subprocess service.
Security warning
This plugin disables DSH's subprocess credential isolation. Every caller
that uses the wrapped subprocess service can pass the Harness process's API
keys, tokens, passwords, secrets, cookies, proxy credentials, and other
environment values to child processes. Model-generated commands, repository
scripts, package installers, CLIs, MCP servers, and terminal programs may read
or exfiltrate those values.
Do not install this plugin on a shared or untrusted Harness deployment. Prefer
a dedicated tool or an exact variable allowlist whenever possible.
The plugin never logs environment names or values by itself. That does not
prevent a child process from printing or transmitting them.
Behavior
DSH normally starts subprocesses from a scrubbed parent environment. Variable
names matching KEY, PASSWORD, SECRET, or TOKEN, plus ambient DSH_*
names, are removed before explicit request entries are merged.
This plugin wraps the three ctx.subprocess operations and supplies an
explicit environment layer built from process.env:
resolveExecutable(command, env, signal)spawn(spec)spawnTerminal(spec)
All three operations must be functions. Own method descriptors must be
configurable; inherited methods and an absent installation marker require an
extensible runtime; an existing marker slot must be configurable. Apply checks
that complete replacement contract before mutation. If defining the marker or
any method still fails, or Cordis rejects effect registration, apply rolls back
the marker and every installed method descriptor before rethrowing the error.
Caller-provided entries are merged after a fresh process.env spread on every
call, so explicit overrides and undefined tombstones retain their original
meaning. The plugin does not mutate caller-owned requests.
Disposal first makes every installed wrapper inactive, then restores previous
method descriptors when the plugin still owns them. A later wrapper that
captured and delegates to a plugin method therefore reaches the original DSH
method with the caller's exact arguments after disposal, without environment
injection. Later method replacements are not overwritten. Installing this
plugin more than once on the same subprocess runtime is rejected while the
first installation is active, avoiding ambiguous out-of-order teardown.
The plugin covers consumers that route process creation throughctx.subprocess. It cannot affect code that bypasses that service and calls
Node.js process APIs, worker APIs, or an SDK-owned spawn directly.
Install into a DSH profile
Until this package is published to npm, clone it and add the local directory:
git clone https://github.com/zhangzujian/dsh-subprocess-inherit-environment.git
cd dsh-subprocess-inherit-environment
npx @deepseek-ai/[email protected] plugin --profile web add "$PWD"
The package declares a DSH bundle, so dsh plugin adds its patch layer to the
profile automatically. Restart DSH if the active profile does not hot-reload
server plugins.
To remove it and restore DSH's default credential scrub:
npx @deepseek-ai/[email protected] plugin --profile web remove @zhangzujian/dsh-subprocess-inherit-environment
For a local file URL overlay:
- insert:
- id: subprocess-inherit-environment
name: file:///absolute/path/to/dsh-subprocess-inherit-environment/index.mjs
Test
Unit tests require Node.js 22 or newer:
npm test
Integration tests run against an installed DSH tree and verify the original
scrub, inherited environment, and disposal restoration without printing any
secret value:
DSH_INSTALL_DIR=/path/to/dsh/install npm run test:integration
DSH_INSTALL_DIR is the directory containing node_modules/@deepseek-ai.
License
MIT
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-subprocess-inherit-environment」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
该插件是 GitHub 源码(未发 npm)——直接从仓库装:
Web profile:
dsh plugin --profile web add github:zhangzujian/dsh-subprocess-inherit-environment Headless(CLI)profile:
dsh plugin --profile headless add github:zhangzujian/dsh-subprocess-inherit-environment 实测报告
验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。
使用场景
扩展 agent 的编码能力面——给它一个新工具、工作流或集成,让它接手以前做不了的开发任务。
适合谁
想让 dsh 在真实代码库上像队友一样干活的开发者——能改、能跑、能验证,而不只是回答问题。
二次开发建议
工具/命令面就是缝:暴露更多 SDK 能力、加更聪明的上下文接线,或收紧改代码与验证之间的循环。