dsh-subprocess-inherit-environment
by zhangzujian
经 ctx.subprocess 转发完整 Harness 环境的 DSH 插件
DSH plugin that forwards the complete Harness environment through ctx.subprocess
安装
dsh plugin --profile web add github:zhangzujian/dsh-subprocess-inherit-environmentGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
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 through
ctx.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/dsh@0.1.0-rc.6 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/dsh@0.1.0-rc.6 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
原始 README: https://github.com/zhangzujian/dsh-subprocess-inherit-environment/blob/main/README.md ↗
同类插件
查看全部 →
dsh-anchored-standard
两阶段 DeepSeek Harness 预设:先 Minimal 对齐的 bootstrap,再切完整 Standard 工具(Project2 98/99)

PicGo-Core
极致的图片上传引擎,CLI 与 API 双支持

awesome-deepseek-harness
DeepSeek Harness(DSH)及其优秀社区插件的精选指南。

awesome-deepseek-harness
DeepSeek Harness (DSH)生态系统:来自dsh-external/hub和公共dsh-plugin主题的精选插件、工具和基础设施。

AI-Novel-Writer
本地优先 AI 小说创作工作台,提供 Windows/macOS 桌面版与 DeepSeek Harness 插件开发预览,支持角色、大纲、章节蓝图、审稿修稿和本地模型。

mcp-for-stata
MCP-for-Stata:把 Stata 集成进你的 agent