DSH Honey Guard: Outbound Honeypot Sanitization—Turning Keys into Dummy Values Before Leaving the Host

Foreword

When running agents in DeepSeek Harness (DSH), user input, model thoughts, and tool call parameters all enter session files and logs, and may be sent to the model side. Once API keys, cloud credentials, or PEM private keys get mixed in, simply deleting logs afterward cannot guarantee that no leakage occurs. The common practice is manual masking or writing regex replacements, but this easily misses formats, and the same real value within a single session gets replaced with multiple fake names, which instead makes the model suspicious.

The community plugin dsh-honey-guard (maintainer elegant01, version 0.1.0, MIT) is introduced below. It performs deterministic replacement with structurally valid Honey-Tokens before sensitive values leave your machine; sessions are honeypots from the source, and explicit tools are used to restore real values when needed.

What Is This

dsh-honey-guard is a honeypot redaction plugin for DSH: it hooks into agent/pre-step and tools/post-execute, performs pattern scanning on every outbound message, and replaces on match. What the model, session files, and logs see are all fake; within the same session, the same real value always maps to the same honeypot, and cross-session mappings cannot be correlated externally.

Repository: https://github.com/elegant01/dsh-honey-guard
Community directory page: https://www.skillhub.cn/plugins/elegant01/dsh-honey-guard

Core Features

Fully Automated Outbound Redaction

Takes effect once installed — no need to configure each message individually. Built-in detectors cover, for example:

Detector Recognizes
sk- + 48 chars OpenAI / DeepSeek-style keys
AKIA + 16 chars AWS Access Key ID
ghp_ / github_pat_ GitHub tokens
Long tokens after Bearer Request header credentials
-----BEGIN PRIVATE KEY----- PEM private keys

Replacement is deterministic: it is structurally valid (e.g., a fake key starting with sk-), so the model only gets one normal authentication failure, and will not see two different fake names for the same credential, avoiding anomalies.

Explicit Restoration and Manual Marking

Automatic inbound restoration is deliberately not done — the restored real value would be seen by the model in the next turn, which would render the redaction pointless. Extension and restoration go through tools:

Tool Purpose
honey_mark Mark values unrecognized by detectors (internal tokens, private key formats) as sensitive
honey_restore Restore honeypots to real values and write back to the session record — visible to the user, invisible to the model (re-redacted in the next turn)
honey_stats Value-safe aggregate statistics (mapping count / replacement count / restoration count / canary status)

Canary Trap

Each session lazily registers a “dead honeypot” that never participates in replacement. If this honeypot appears in text from other sessions, an alert is raised, used to detect records being carried across sessions.

Architecture Notes (Behavior-Relevant)

  • Admission-time replacement: Outbound redaction happens before messages enter the session (the batch returned by agent/pre-step is the content entering the session), so session files are honeypots from the source.
  • Interval-merging replacement: Detector intervals and manual marking intervals are merged first (overlapping ones skipped, longer values prioritized), then stitched together in one pass, so honeypots will not re-enter the scanned text.
  • Per-session independent mapping: WeakMap<agent, scope> buckets by agent; mappings are purely in-memory and not persisted.
  • Value safety: Logs, statistics, and audit events (honey/restored) contain no real values or honeypot values.

Installation and Activation

Given that the plugin source directory already exists locally, install via profile (the command comes from the project README; replace the path with your actual path):

dsh plugin --profile desktop add "file:<path to this project>"

You can also manually place it into the profile’s node_modules and register it in dsh.profile.bundles.

Development and verification (requires Node ^22.19.0 || >=24.0.0):

pnpm install
pnpm run check   # typecheck + vitest + tsdown build

The plugin runs with the permissions of the current DSH process; please read the source code and the MIT license before installing to confirm it complies with your security policy. SkillHub is a community directory and has no official affiliation with DeepSeek / High-Flyer.

Typical Usage Patterns

  1. After installing and enabling the plugin, normal conversations and tool calls work as usual; outbound content is scanned and replaced before entering the session.
  2. For internal keys in custom formats, mark them in the session via honey_mark; subsequent outbound content also goes through the honeypot mapping.
  3. When you need to execute a step with a real value locally (e.g., local curl with a real Bearer token), use honey_restore to write it back to the record; note that in the next turn the model side will still see the redacted value.
  4. Use honey_stats to check the scale of mappings and replacements, and watch whether Canary triggers cross-session alerts.

Specific tool parameters are subject to the repository’s current implementation; see the GitHub README and the lib exports.

Use Cases and Caveats

Suitable for: developers who run agents long-term in DSH desktop or self-built profiles, but do not want to write cloud/Git/model API keys into sessions and logs.

Caveats:

  • Redaction covers the patterns listed in the README and manual marking; it cannot replace complete key management and least privilege.
  • No automatic inbound restoration is a design choice; when relying on explicit honey_restore, think carefully about when real values will enter the model context again.
  • Peer dependencies include @deepseek-ai/cordis, @deepseek-ai/dsh-llm, @deepseek-ai/dsh-tools, etc., and must match the current DSH version.

Conclusion

dsh-honey-guard treats DSH’s outbound pipeline as a unified interception point: deterministic Honey-Tokens, session-level mappings, explicit restoration, and Canary, adding a default-on leak protection layer in the “everything is a plugin” DSH ecosystem. For further information, visit the SkillHub directory page and the GitHub repository.

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

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

Xiaoye