dsh-secrets-manager: Managing Project Secrets in DSH Without Exposing Values to the Model

Introduction

When building agents in DeepSeek Harness (DSH), a common tension is that command-line tools need variables like API tokens and database passwords, yet you do not want those values to appear in conversations or the model’s context. Putting secrets in .env and sourcing them in bash is the usual approach; in a monorepo, the root directory and each workspace package may each have .env files, and these must be layered together with DSH’s global configuration. Manually maintaining them can lead to missed files and messy comments.

The following describes the community plugin dsh-secrets-manager (maintainer lifecoder1988, category admin-security): it lets you securely edit secrets in Settings and the conversation header, scans dotenv files across a monorepo, and provides DSH_ENV_FILE / DSH_ENV_FILES pointers for each bash call so the model only knows “which keys exist and which files they are loaded from,” without seeing the actual values.

What Is This

dsh-secrets-manager is a plugin for DeepSeek Harness. Repository: github.com/lifecoder1988/dsh-secrets-manager. Directory listing: plugin entry on skillhub.cn.

It addresses three things: discovering .env-related files within a monorepo (plus a one-level global); preserving comments, ordering, and quoting style when adding, deleting, or editing keys in the UI; and delegating the loading chain to the shell rather than putting values into tool results or list APIs.

The DSH ecosystem is “everything is a plugin”; community directories such as SkillHub are not officially affiliated with DeepSeek / High-Flyer. Before installing, review the source code and the MIT license yourself, and keep in mind that plugins run with the permissions of the current dsh process.

Core Features

Environment Variable Pointers (for bash, not for the model to see values)

Once installed, each bash call is injected with:

Variable Content
DSH_ENV_FILE The .env closest to the cwd; if the project has none, it is $DSH_HOME/.env
DSH_ENV_FILES The full chain (:-separated): the global file first, then project files from the repo root to the cwd
DSH_ENV_KEYS All key names on the chain (deduplicated, without values)

The model can load them using the README example, while tool output only shows names:

set -a; for f in ${DSH_ENV_FILES//:/ }; do [ -f "$f" ] && . "$f"; done; set +a

The global layer $DSH_HOME/.env (DSH_HOME defaults to ~/.dsh) is at the front of the chain; later loads override earlier ones, so a project can override global defaults. If the project has no .env, variables can still be obtained via the global file. The DSH process itself reads the global dotenv at startup (for example NEW_API_KEY); after changes you need to restart dsh web. Secrets intended for bash are sourced on every call, so changes take effect immediately.

Discovery and Editing

  • Global layer: $DSH_HOME/.env is shown as a separate card and can be added to, edited, and deleted like project files.
  • Monorepo discovery: the repository root plus package directories under pnpm-workspace.yaml / package.json workspaces are indexed, covering .env, .env.local, .env.<mode>, etc. (bounded by maxPackages).
  • Per-directory view: one card per directory listing key names (values are masked by default) and showing the effective shell load order.
  • Safe writes: add/edit/delete preserves comments and ordering and performs an atomic replace when writing the file; writable scope is limited to within the project root and to files matching .env* in the global directory.
  • Refresh: if a project .env is changed externally, you can rebuild the index (the global file is read live on every shell call and does not need refreshing).

Model Tool project_secrets

action Key parameters Description
list cwd? Indexed directories and key names plus the global layer; with cwd, shell facts are included
files — Paths of all .env files
set path?, scope?, key, value Write; scope: "global" writes the global file
remove path?, scope?, key Delete a key; scope: "global" deletes from the global file

scope: "global" refers to $DSH_HOME/.env; scope and path are mutually exclusive.

UI

  • Settings (settings.section, order 32): a grid of variable files, with the global card first, a key list with values masked by default, and show/edit on demand.
  • Conversation header (conversation.session.header.utilities, order 53): an icon opens a writable panel that does not pre-read values; clicking the eye icon issues a single POST /file to fetch; includes an “Open management page” entry.
  • DevSpace: when the current workspace is a remote image, the settings page and conversation panel can scan the corresponding node on demand (about a dozen seconds, cached for 60 seconds); for non-image workspaces the remote section is not shown.

The HTTP route prefix is /secrets-manager (for example GET /state, POST /file, POST /write, POST /refresh).

Installation and Enablement

The README recommends installing with DSH’s built-in plugin_manager (it automatically writes the profile and inserts the composition line). For manual installation, go to the current profile directory and run:

cd "$DSH_HOME/profiles/<profile>"
pnpm add github:lifecoder1988/dsh-secrets-manager

In the profile’s cordis.patch.yml you can add it manually:

- insert:
    - id: secrets-manager
      name: '@local/dsh-secrets-manager'

After installation: host-side changes require restarting DSH; client-only changes can be applied by refreshing the page.

Optional configuration (excerpt from the README):

config:
  maxPackages: 200        # Maximum number of package directories to index in one pass
  dshHome: /path/to/.dsh  # Global layer directory; defaults to $DSH_HOME, then ~/.dsh
  globalEnv: /path/to/env # Directly specify the global env file; highest priority

Inside the repository you can run node test/local-check.mjs for an offline self-check.

Typical Usage

  1. After installing and restarting DSH, view the scanned .env files and the global layer in the “secrets-manager” section of Settings, and add or modify keys as needed (values do not appear in model-visible outputs of list / /state).
  2. In conversations, when you want the agent to run commands that require secrets, rely on the injected DSH_ENV_FILES and source them with the set -a loop above, rather than asking the model to echo secret values.
  3. When you need to change global defaults or only local DSH configuration, edit $DSH_HOME/.env; if you change an item that the DSH process reads at startup, restart dsh web afterward.
  4. Maintain files such as .env.local at the monorepo root or in each package; after editing them in an external editor, click refresh on the settings page to rebuild the project index.

Use Cases and Caveats

Suitable for: running bash in DSH, connecting to third-party APIs or databases, and wanting unified management of dotenv files across a monorepo and global DSH configuration; editing keys in the UI without exposing plaintext to the conversation context.

Notes:

  • Security boundary: list, /state, and inspect only report key names and paths; values appear only in /write request bodies and in .env files on disk.
  • The plugin runs with the same permissions as DSH; read the GitHub repository source code before installing.
  • Files in the global directory that do not match .env* (such as credentials.yaml) will be rejected for writing.

Conclusion

dsh-secrets-manager separates “the project needs secrets” from “secrets must not enter the conversation”: values live in files, the model and list APIs only receive pointers and key names, and the shell loads them according to the chain. For more information, visit the SkillHub directory page and the GitHub README.

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

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

Xiaoye