Back to home

zhangzujian

dsh-subprocess-inherit-environment

DSH plugin that forwards the complete Harness environment through ctx.subprocess

Stars
0
Language
JavaScript
Created
Aug 14, 2026
Updated
Aug 14, 2026
Other
GitHub repo

Introduction

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)

Caller-provided entries are merged after process.env, so explicit overrides and undefined tombstones retain their original meaning. The plugin does not mutate caller-owned requests. Disposal restores the exact previous methods and does not overwrite wrappers installed later.

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