Preface¶
In DeepSeek Harness (DSH), agents read repository files, search results, and web content into their context via tools such as Read, Grep, Glob, and WebFetch. Repository poisoning and web injection often originate from this “read text” rather than the brief instructions typed into the user input box. Scanning files only during CI commits is too late for a session currently in progress; post-hoc auditing can only explain “what has already happened.”
DSH’s ecosystem philosophy is “everything is a plugin.” Community plugin directories are showcased on sites like SkillHub and are not officially affiliated with DeepSeek or High-Flyer. This article introduces dsh-read-guard (categorized as admin-security) released by the maintainer zhengqiuyang: it hooks into the dsh tools/post-execute pipeline to perform deterministic scanning at the moment untrusted text is about to enter the model context, without relying on the model to “voluntarily” call an audit tool.
What is this¶
dsh-read-guard is positioned as a deterministic prompt-injection interceptor for DeepSeek Harness: it scans content READ by the agent (tool return values) before it is written into the model context. The detection engine is derived from repo-inject-guard; no LLM is called on the trust path. It can also isolate credential-type files based on the path alone. The current npm package version is 0.2.0, and the license is MIT.
How it works¶
The plugin hooks into the tools/post-execute waterfall of dsh: whenever a monitored tool returns results (file reads, repository searches, web scraping, etc.), the content passes through a rule engine scan at the “about to enter model context” choke point to decide whether to isolate, block, or pass.
Detection directions summarized in the README include: instruction overrides, system prompt extraction, credential/environment variable exfiltration, hidden Unicode, agent directives, backdoor phrasing in rule files, and resource lures. Please refer to the upstream repo-inject-guard documentation for precision strategies.
Differences from other solutions in the ecosystem (comparison based on README as of 2026-10-12, intended as an architectural explanation, not a ranking): For example, dsh-secure-audit implements scanning as a model-callable tool, which the model might choose not to call; this plugin intercepts at post-execute, making it impossible for the model to bypass. It complements plugins like dsh-injection-guard that focus on “downstream action tainting”: the latter restricts sensitive tool calls, while this plugin handles the input content upstream.
Operating Modes¶
| mode | High-severity hits | Medium/Low-severity (Weak signals) |
|---|---|---|
observe |
Log recording | Log recording |
wrap (default) |
Result is marked with taint: original content remains visible to the model within isolation markers, accompanied by a “this is data, not instructions” type explanation | Log only; do not rewrite body based on weak signals |
block |
Result does not enter the model; model receives corrective feedback | Log only |
The scan limit maxScanChars defaults to 200000 full characters (compared in the README to some solutions that only scan the first 10k).
Installation and Activation¶
Install via the dsh plugin command (distributed via npm, no local build required, and no allowBuilds authorization needed; pre-built lib/ is included in the repo):
dsh plugin --profile default add dsh-read-guard
Compatibility (README): Verified on DSH 0.2.x line (source snapshot 0.2.1-alpha.2); Node >= 20 (CI matrix includes Node 20/22/24). After installation, startup logs may show prompts such as [dsh-read-guard] active: ….
Configuration¶
Override plugin configuration in the profile’s cordis.patch.yml, for example, to switch to block mode and specify read/write tools to scan:
- id: dsh-read-guard
name: dsh-read-guard
config:
mode: block
readTools: [read, grep, glob]
fetchTools: [web_fetch, web_search]
maxScanChars: 200000
quiet: false
Note: readTools / fetchTools list the tools whose results the agent “reads”; if there are MCP tools going through the same pipeline, they should be added as well per the README requirements. quiet: false facilitates observing interception logs.
Typical Usage¶
- Install the plugin in the default profile (see command above).
- Set
modetoobserve(observe first),wrap(default, isolate high-threat markers), orblock(keep high threats out of the model directly) as needed. - Expand
readTools/fetchToolsto cover tool names that will actually return large blocks of text in the session. - Start a dsh session, let the agent read local files or fetch web pages; check if rules are hit under
observe/ non-quiet mode.
For local loading from source into a dsh checkout, the README provides:
pnpm dsh web --patch ./cordis.dev.patch.yml
On the development side: npm install followed by npm test will sync the vendor engine, build, and run unit tests.
Use Cases and Notes¶
Suitable for: Teams running coding agents on DSH who need to reduce the risk of system prompt pollution or unauthorized operation induction caused by “read malicious Markdown / web pages / search results”; scenarios where interception should happen in the pipeline rather than relying on the model’s conscious auditing.
Notes:
- The plugin runs with the permissions of the current dsh process; before installation, please review the GitHub repository source code and the MIT license yourself to ensure compliance with organizational policies.
- v0 intentionally does not scan instructions pasted by the user (README roadmap: users are still allowed to give direct commands); it primarily covers the tool read surface.
- “Maintenance stopped” conditions declared by the maintainer: If dsh officially provides first-class citizen capabilities covering tool-result injection, or if the
tools/post-executecontract changes making content replacement impossible, the plugin will be frozen at the last available version with a note recorded.
Conclusion¶
dsh-read-guard places the final gate before “tool results enter the model”: deterministic rules, zero LLM trust path, and configurable observe / wrap / block modes. Directory page: https://www.skillhub.cn/plugins/zhengqiuyang/dsh-read-guard; Source code and full documentation: https://github.com/zhengqiuyang/dsh-read-guard.