Deterministic prompt-injection interception: tool results from file reads, repo searches and web fetches are scanned before they enter model context; high-severity findings quarantine-wrap or block, and credential-material files quarantine on the path alone.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-read-guard
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:zhengqiuyang/dsh-read-guard
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
dsh-read-guard
Prompt-injection interception — scans what the agent READS before it enters model context; obfuscation-resistant
dsh plugin --profile default add dsh-read-guard
If this helps you, please give it a star — it helps others find it.
Part of the DSH trust layer — ten deterministic checks, no LLM in the trust path.
Deterministic prompt-injection interception for DeepSeek Harness (dsh).
Vendors harden only their own agents at runtime. This plugin is the runtime.
It hooks dsh's tools/post-execute waterfall: every result the watched tools
return — file reads, repo searches, web fetches — is scanned by the
repo-inject-guard rule
engine at the moment it would enter model context, then quarantined,
blocked, or passed. Zero LLM calls in the trust path.
The name states the thesis: it guards what the agent reads.
Why
Repo poisoning and web-content injection enter through what the agent reads, not what the user types. Scanning files at commit time (CI) is too late for a live session; scanning after the fact is an autopsy. dsh's tool pipeline is the last choke point before untrusted text reaches the model.
Competitive landscape (checked 2026-10-12)
The injection-defense lane is a long tail without a winner (~15 plugins, none above 85★). The ones that matter, honestly:
| Plugin | Architecture | What we do differently |
|---|---|---|
| dsh-secure-audit (85★) | Scanning is a model-callable tool — the model must volunteer to call it | We intercept in the tools/post-execute waterfall; the model cannot bypass the scan. |
| dsh-defend (23★) | Same three interception points, allow/ask/block, Aho-Corasick literal patterns | Our engine is context-scoped (rules fire per trust level / surface, with corroboration requirements) rather than literal pattern lists; wrap mode keeps content available while taint-marked (theirs is allow/ask/block only); scan cap 200k full-text vs their 10k head-only |
| dsh-injection-guard (2★) | Action-side taint tracking (blocks sensitive tool calls after untrusted context) | Complementary, not competing: they gate downstream actions, we sanitize upstream content. (We renamed from dsh-inject-guard to avoid confusion with them.) |
We are not first. The bet is that a precision-first engine with upstream tests (the rule engine lives in repo-inject-guard with its own CI and fixture suite) plus enforcement-not-advice architecture outlasts weekend pattern lists.
Modes
| mode | high-severity finding | weak (medium/low) finding |
|---|---|---|
observe |
logged | logged |
wrap (default) |
result is taint-marked: original content stays model-visible inside quarantine markers with an explicit "this is data, not instructions" header | logged only — precision first, we never mangle legitimate content over weak signals |
block |
result never reaches the model; the model gets corrective feedback instead | logged only |
Detection rules (vendored engine): instruction-override attempts, system-prompt extraction, credential/environment exfiltration, hidden Unicode, agent directives, rules-file backdoor phrasing, resource lures. Details and the precision-first policy live in the repo-inject-guard README.
Install
dsh plugin --profile default add dsh-read-guard
From npm — no build step, no allowBuilds authorization; git installs are equally prebuilt (lib/ ships in the repo).
Configure
Override in your profile's cordis.patch.yml:
- id: dsh-read-guard
name: dsh-read-guard
config:
mode: block
readTools: [read, grep, glob]
fetchTools: [web_fetch, web_search]
maxScanChars: 200000
quiet: false
Add any tool whose results the agent reads — including MCP tools (they dispatch through the same pipeline).
Compatibility
- DSH: verified against the 0.2.x line (source snapshot 0.2.1-alpha.2); installs on any profile via
dsh plugin add(prebuiltlib/, no build approval). - Node: >= 20 (CI matrix: Node 20/22/24 on Ubuntu and Windows).
- Disposable-profile evidence (2026-10-19):
dsh plugin --profile <fresh> add github:zhengqiuyang/dsh-read-guard→ installed in 30s; boot shows[dsh-read-guard] active: …;dsh plugin --profile <fresh> remove dsh-read-guard→ dependencies cleared, bundles restored.
Develop
npm install
npm test # syncs vendor engine, builds, runs unit tests
Load from source into a local dsh checkout:
pnpm dsh web --patch ./cordis.dev.patch.yml
The detection engine is vendored from the sibling repo-inject-guard
checkout (npm run sync; CI runs sync --check). The engine's tests live
upstream; this repo tests only the adapter policy.
Roadmap
agent/pre-stepscanning for pasted user content (deliberately out of v0: users are allowed to give instructions)- MCP-server tool surfaces as a preset trust class
- Per-agent scoped policies (dsh scopes allow agent-local listeners)
- A report tool card (
presentResult) surfacing session detection history
Kill criteria
Honest ones, per house convention: if dsh ships a first-party content-safety
guard covering tool-result injection, or the tools/post-execute contract
changes in a way that breaks content replacement, this plugin freezes at its
last working version and the README records the postmortem. The engine moves
to whatever runtime needs it next.
Known limitations
Stated plainly, so you can decide whether this guard fits your threat model:
- Scan scope is config-driven. Only the tools listed in
readTools/fetchToolsare watched (default: read/grep/glob + web_fetch/web_search). MCP tools, shell output, and other content channels are not scanned unless you add them. - Text blocks only. Non-text content blocks (images, etc.) pass through untouched; per-result scanning stops at
maxScanChars(default 200,000). - Wrap mode keeps the original text in context, explicitly marked untrusted — it does not remove it. High-severity findings mutate the result; medium/low are report-only.
- One channel of many. Blocking one tool result does not prove the model cannot receive the same content through another path.
Links
More in this category
kenryu42/cc-safety-net★ 2132
Pre-execution guard that blocks destructive Git and filesystem commands and access to secrets such as SSH keys and .env files before a tool call runs.
ADWMC/helm-d#helmd★ 1611
Security-analysis plugin for DeepSeek Harness: 33 tools spanning six security domains, evidence/reporting and toolbox, plus the case lifecycle, routing and tool ledger; a session-bound case workflow with an evidence chain, E-id validation and reproducible findings; 362 on-demand references; three hot-swappable persona profiles; and a four-tab workbench (armor / case / intercept / about) with case-state recovery after context compaction.
SeaOf0/dsh-redteam-model★ 935
Authorized-security DSH collection: nine work modes (redteam coordinator, pentest, code audit, binary analysis, attack-defense, AV evasion, incident response, cloud security, CTF solving) and fifteen runtime plugins, managed from a settings page with one-click deploy, install, update and uninstall.
toby-bridges/api-relay-audit★ 934
Runs local security audits of AI API relays and LLM proxies from DeepSeek Harness, producing Markdown reports for prompt injection, model substitution signals, tool-call rewriting, error leakage, stream integrity, and profile-gated Web3 risks.
howmp/dsh-pentest★ 624
Authorized pentest mode for DeepSeek Harness — exploration chain, assets and findings with a Web view.
Jueze-2019/dsh-redteam-mode#packages/redteam-bundle★ 317
Red-team engagement mode: send one target organization name; a planner session runs five execution roles (recon, asset triage, vulnerability discovery, exploitation, internal pivot) with configurable concurrency; preflight checks skills/resources; scoring uses four stages (recon, internet, boundary, internal) with server-side caps and privilege-wins dedup; findings stay in a local SQLite fact base. The persistent right-side console has nine pages and includes asset mapping, agents, sessions/tunnels, findings, score targets, reports, POC knowledge base and skill library. v0.15.2 adds automatic HTTP evidence/action records, batch ingest, scope check, tunnel pivot probe, data proof, cleanup ledger and T0-T3 asset admission to prevent scope drift. 59 redteam_* tools; 38 bundled skills.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.