dsh-destinywind-tpm: Sealing DSH Credentials with TPM/DPAPI to Replace Plaintext Files

Preface

In DeepSeek Harness (DSH), sensitive values such as model API Keys are often resolved through a credentials service: the official default implementation writes referenced values into .credentials.yaml under $DSH_HOME, which are stored in plaintext on disk regardless of file permission strictness. If the local machine’s configuration is copied, backups are mistakenly committed, or development machines are shared by multiple people, the risk centers on the fact that “the file contains the actual value.”

The dsh-destinywind-tpm plugin, provided by community maintainer rickwindman, belongs to the admin-security category in the DSH plugin directory. It acts as a credential provider: it applies AES-256-GCM envelope encryption using the strongest local protector available before writing to disk, and only unseals values upon resolution. If no protector is available, it refuses to mount and prevents plaintext storage. The following sections explain what it is, how to install it, and its impact on existing keys when switching providers.

What is this

dsh-destinywind-tpm is a DSH bundle plugin for cross-platform hardware/user-level credential storage, maintained by rickwindman. The current package version is 1.0.0, licensed under MIT.

In Cordis, it occupies the same slot mutually exclusively with the official @deepseek-ai/dsh-credentials-local (plaintext .credentials.yaml): a context can only mount one credentials service. The settings page and various plugins still use the standard credentials interface, so consumers are unaware of whether the underlying implementation is plaintext or a sealed vault.

Platform behavior (from the original source):

  • Windows: TPM (CNG Microsoft Platform Crypto Provider) preferred, DPAPI fallback
  • Linux: TPM 2.0 (tpm2-tools) preferred, session keyring fallback (libsecret)
  • If neither is available: refuse to mount, never write plaintext

Core Features

Sealing and Vault

Referenced values and records are sealed by the local protector before being written to disk. The vault file path is:

$DSH_HOME/.credentials.dpapi.json

File permissions are 0600, and it utilizes a staging + atomic rename approach for writing to disk.

No Plaintext Fallback

On a fresh installation, no credentials can be resolved until a new value is saved—this is a deliberate design choice, not a “plaintext first, then migrate” approach.

Local Machine and User Binding

The vault cannot be decrypted if copied to another machine or account; migrating the vault as a backup will render it invalid.

Startup Verification

Upon startup, all ciphertexts are re-unsealed; any failure in unsealing will trigger an error rather than a silent downgrade to plaintext or another provider.

Resolution Order (Consistent with the official provider)

  1. Process environment variables (from the shell starting dsh or system user variables)
  2. This plugin’s vault (official provider uses .credentials.yaml)
  3. Project .env (in the starting directory) → User .env ($DSH_HOME/.env)

Environment variables with the same name take precedence over the vault; if they exist, the vault’s set/unset operations will also refuse to write that reference to avoid accidental modification. If a “Key changed in settings but didn’t take effect” issue occurs, first check if an old variable still exists in the startup environment.

Installation and Enablement

The plugin declares dsh.bundle.patch, which takes effect immediately upon installation without manual Cordis configuration changes. The patch overrides the default credentials line by ID (setting disabled: true).

Cordis declarative installation:

plugin_manager { action: "install_bundle", target: "<absolute path to this repo>" }

Command line equivalent:

dsh plugin --profile web add link:<absolute path to this repo>

Restart dsh web after installation to take effect.

Disabling this bundle restores the default provider; already sealed values remain sealed. When returning to the official plaintext provider, values must be re-entered (the official provider cannot read the sealed vault). When switching from the official provider to this plugin, old values in .credentials.yaml will not be read; you need to re-enter them in the settings page to store them in the vault. The old file can be deleted manually after confirming it is no longer needed. There is no automatic migration in either direction; this is by design.

Typical Usage

After installation and restart, usage is consistent with the standard DSH credentials flow: write references in the settings page or via the credentials API (e.g., the DeepSeek provider stores the Key as a reference name like DEEPSEEK_API_KEY; the configuration only holds the reference, while the actual value resides in the credentials service). Resolution follows the order described above; values are written to .credentials.dpapi.json and sealed by the local protector.

The repository’s tests/ directory provides local integration tests (offline end-to-end + module resolution hook), which depend on the author’s local D:\dsh path and cannot run directly in CI. To verify the implementation locally, run the following in the repository root:

node --import ./tests/resolve-hook.mjs tests/offline.mjs

Applicable Scenarios and Notes

Suitable for: Local development or running DSH where you do not want API Keys and other credential references to remain on disk as plaintext YAML long-term; environments on Windows/Linux capable of using TPM or fallback protection (DPAPI / libsecret).

Unaffected parts (when switching engines): Login states for model connectors (e.g., workbuddy / trae); values in process environment variables and .env (they are outside the vault resolution chain or override it based on priority).

Parts requiring re-entry: Referenced values within the credentials service, including model API Keys configured in the settings page.

Security and Trust: The plugin runs with the current dsh process permissions. Before installing, read the source code and the MIT license on GitHub to ensure compliance with your requirements. The community plugin directory SkillHub and DeepSeek / High-Flyer have no official affiliation; selection and auditing responsibility lies with the user.

Conclusion

dsh-destinywind-tpm replaces DSH credentials plaintext files with TPM/DPAPI (and equivalent Linux fallbacks) sealing, and refuses to mount when no protector is available. It is suitable for scenarios with strict requirements for local key storage. Directory page: https://www.skillhub.cn/plugins/rickwindman/dsh-destinywind-tpm; Source code and README: https://github.com/rickwindman/dsh-destinywind-tpm.

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

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

Xiaoye