dsh-tui-secret: Securely Entering and Managing Credentials in dsh-TUI

Introduction

When using agents to write scripts or call APIs in DeepSeek Harness (DSH), keys and passwords often need to be placed into environment variables or configuration files. If plaintext is written into conversations, logs, or handed directly to the model as strings, the exposure surface becomes significant if the context is exported or recorded by the toolchain. Common practices include using local credential files with strict permissions or completely manual pasting—but the former still lacks a unified entry point for “how to authorize when the Agent needs to use it,” while the latter disrupts the workflow.

Below is an introduction to the community plugin dsh-tui-secret (maintainer zerodegress): designed for dsh-TUI, it performs masked input via a fullscreen /secrets scene and writes values only into DSH’s native ctx.credentials seam. The plugin does not echo, log, or put secrets into the conversation. The Agent side can only initiate “request input” or “use in subprocess” via two runtime tools, and the return values contain only status or redacted output.

What is this

dsh-tui-secret is a dsh-TUI plugin categorized under admin-security. In one sentence: it provides secure secret entry for dsh-TUI (/secrets: masked input → reference list → deletion confirmation) and constrains the Agent to access secrets only through DSH credential storage and controlled subprocesses, rather than handing values to the model or session.

The current package version is 0.2.0, licensed under MIT, requiring Node.js ^22.19 || >=24. The officially stated supported target host is @deepseek-harness-tui/dsh-tui 0.16.x; other TUI implementations are out of scope.

Core Features

User Side: /secrets Scene

After restarting the TUI, enter /secrets to access the fullscreen scene:

  • Press a to create a new reference: first enter the name, then the value. Input displays • per character (configurable to show no length at all).
  • The list only shows configuration status, source, and writability; it does not show secret values. d deletes the selected reference (requires y confirmation), v revokes Agent permissions for that reference, and R revokes all Agent permissions (y confirmation; stored values are preserved).
  • Reference names must comply with DSH rules: start with an uppercase letter, contain only A-Z, 0-9, _, and be max 64 characters. DEEPSEEK_ / DSH_ prefixes are reserved by the host; the plugin will reject them on the spot with a readable reason.

Configuration example (written into the profile’s cordis.patch.yml fragment):

- insert:
    - id: dsh-tui-secret
      name: dsh-tui-secret
      config:
        entryCommand: secrets   # Can be changed to another command name
        echo: dots              # One • per character; set to none to hide length entirely

echo: none is suitable for scenarios like screen sharing or screen recording where you don’t want to expose even the length; the default dots displays a dot matrix equal in length to the secret on the screen.

Agent Side: Two Tools

The host has no tool list contract; the plugin registers them at runtime:

Tool Parameters Return
request_credential ref, purpose stored / cancelled / refused
use_credential ref, argv[], timeoutMs? exitCode, stdout, stderr, redacted, timedOut, aborted, injectedAs

request_credential pops up a card in front of you: showing the name, purpose, and four authorization options (Not allowed / Once / This session / Until a specific time); you type the value on the card, the model cannot pass the secret via tool arguments. Upon consent, the value enters ctx.credentials; the tool result contains only status, and the secret does not enter the conversation.

use_credential executes a command in a separate subprocess: the secret is injected into that subprocess as an environment variable named injectedAs (reported in the return), and will not enter the shell where you or the Agent resides. Any occurrences of the value in the returned stdout/stderr are replaced with [credential]. argv is passed as an array to the plugin with per-element referencing; the model cannot directly stuff raw text into the shell. If pipes or variables are needed, you must write it yourself in the form of, for example, ["sh","-c","…"].

The plugin does not register a shell environment contributor, so $NAME will not enter the environment where the model executes; the surface facing the model consists only of the two tools mentioned above.

Installation and Activation

For supported TUI versions, see above. In the shell:

dsh plugin --profile dsh-tui add github:zerodegress/dsh-tui-secret

Or within the TUI:

/plugin install https://github.com/zerodegress/dsh-tui-secret

You can also add the same line insertion configuration found in the package’s cordis.patch.yml to your profile’s cordis.patch.yml (the install bundle mechanism will apply it). After completion, restart the TUI and execute /secrets (or your configured entryCommand).

Typical Usage

  1. Manually maintain the key store: /secrets → a → enter reference name and value under mask → Enter to write to DSH credential storage.
  2. Agent requests credentials: Model calls request_credential(ref, purpose) → you select the authorization scope in the card and type the value → the conversation only sees status like stored.
  3. Agent needs to run a command with a key: With the secret stored and authorized, the model calls use_credential(ref, ["your","cli","args"]) → you already have that ref in local credentials; the subprocess gets the environment variable, while the conversation and tool returns only see redacted output and exit codes.

Key summary: ↑/↓ to move selection, Enter for next step or confirm write, Esc to go back; on the Agent request card, permissions are selected using arrow keys only, number keys belong to the secret content itself.

Storage and Implementation Details

Content Location Description
Secret values (DSH managed) <DSH_HOME>/.credentials.yaml Mode 0600, guaranteed by provider
Reference name index (this plugin) $DSH_TUI_HOME/dsh-tui-secret/refs.json (default ~/.dsh-tui/…) Name index only, not a secret vault; file 0600, dir 0700, atomic writes

Because ctx.credentials has no list(), the plugin uses refs.json to record reference names that have been entered; if corrupted, it reads as an empty list and does not blindly overwrite. Values are written only via ctx.credentials.set(ref, value); the plugin does not write to .credentials.yaml itself. React state also does not retain secrets (using useRef and discarding local copies before writing).

Development side: npm test validates dsh-plugin.json and the TUI profile, and performs frame-by-frame testing of the scenes. Manifest drift will fail locally.

Use Cases and Notes

Suitable for developers using dsh-TUI 0.16.x for long-term local development who need the Agent to occasionally use API Keys, database passwords, etc., and wish to keep secret strings out of the LLM context by default. Compared to “writing keys in .env and letting the model read files,” this plugin separates entry, authorization, and usage into a UI and two restricted tools, emphasizing output redaction.

Please note before installation:

  • The plugin runs with current dsh process permissions; before installation, you should review the GitHub source code and the MIT license yourself. The community directory SkillHub plugin page has no official affiliation with DeepSeek / High-Flyer and is not an official app store.
  • Known limitation: DSH credential storage is plaintext YAML (0600 only prevents other local users; sandbox limits writing but not reading); there is no encryption. If your threat model includes other processes on the machine or backup leaks, you need additional encryption or external secret management; you cannot rely solely on this plugin.
  • If the ctx.tuiScenes seam is missing, the scene will silently fail to respond, but it will not crash the TUI startup.

Conclusion

dsh-tui-secret consolidates “secret entry, listing, and revocation” into /secrets, narrowing the Agent’s reach to request_credential and use_credential, where values flow only through the DSH credential seam and subprocess environments. To view metadata or installation entries, see SkillHub: zerodegress/dsh-tui-secret and the repository github.com/zerodegress/dsh-tui-secret.

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

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

Xiaoye