dsh-phishing-guard: Scanning for suspicious instructions in text read by agents before storage

Preface

Knowledge bases, web scraping results, email templates, and prompt files are often read by an agent before participating in inference. Paragraphs that appear normal to the human eye may contain “ignore previous instructions,” words split by zero-width characters, white-on-white HTML text, or compliance sentences with exfiltration URLs. It is difficult to intuitively block such indirect injection and knowledge base pollution at runtime. DeepSeek Harness (DSH) splits capabilities into plugins; @deepwhale-cn/dsh-phishing-guard (Community Directory feely0208/dsh-phishing-guard, category admin-security) performs static checks before ingestion: it only scans text that the agent will read, lists suspicious patterns and the evidence for them, and does not conclude that an “attack has occurred.” It has a different division of labor from dsh-tool-vet (which audits code before installation) and dsh-secret-scan (which scans for repository keys)—this plugin focuses on “whether someone is giving commands within the content fed to the agent.”

What is this

Maintainer feely0208 (part of the DeepWhale Guardian series). npm package name @deepwhale-cn/dsh-phishing-guard, current version 0.1.0, MIT License.

IS: A rule-based scan of text content intended for ingestion—such as documents, knowledge bases, prompt templates, scraped web pages, and email templates—looking for patterns like instruction overrides, social engineering scripts, hidden characters, hidden HTML styles, data exfiltration directives, and system role markers.

IS NOT:

  • Not a runtime protection; it does not block or isolate;
  • Not a code audit; it does not scan code files like .js / .py / .ts;
  • Not a human-facing phishing email detector;
  • A hit only indicates “this text contains such a pattern”; you must confirm whether there is actually a problem.

In short: It does not look at code; it only looks at the words the agent will read.

Core Features: 9 Rules, 5 Directions

The scan scope is limited to text-based extensions: .md, .txt, .json, .html, .htm, .yml, .yaml. Each hit provides the file path, line number, the line fragment, and the rule ID.

Direction Rule ID What it checks Level
Instruction Override PHISH-INSTR-OVERRIDE “Ignore previous instructions”, “ignore previous instructions”, “forget your rules”, “You are now unrestricted…”, etc. High (🔴)
Impersonation + Urgency PHISH-AUTHORITY-URGENCY Same line claims to be admin and includes urgency/immediately/right now 🔴
Hidden Text PHISH-HIDDEN-INWORD Invisible characters inserted in the middle of words (e.g., “忽 + U+200B + 略”) 🔴
Hidden Text PHISH-HIDDEN-STRAY Stray zero-width characters Medium (🟡)
Hidden Text PHISH-HIDDEN-BOM U+FEFF inserted in the middle of text (file header BOM does not count) 🟡
Hidden Text PHISH-HIDDEN-HTML-INLINE HTML hidden styles and directives on the same line 🔴
Hidden Text PHISH-HIDDEN-HTML-BLOCK Hidden styles and compliance directives in the same file (cross-line) 🟡
Data Exfiltration PHISH-EXFIL-DIRECTIVE Directives with recipient addresses, like “Send … to https://…” 🔴
Role Reset PHISH-ROLE-MARKER Compliance directives immediately following a system: line or <system> tag 🔴

Criteria sources include OWASP Top 10 for LLM Applications 2025 (LLM01, LLM06), MITRE ATLAS related techniques, NIST AI 100-2, Unicode and WHATWG HTML standards, etc. See the repository README for details.

Installation and Activation

Install in DSH (commands follow the README):

dsh plugin --profile web add @deepwhale-cn/dsh-phishing-guard

Requirements: dsh version >=0.1.0-rc.6 <0.3.0, Node.js >=18. The plugin runs with the current DSH process permissions; please review the GitHub repository source code and MIT license before installing.

Typical Usage

Use via the CLI dsh-phishing-guard after installation.

Scan a knowledge base directory ready for ingestion:

dsh-phishing-guard --root /path/to/knowledge-base

View the built-in demo samples (a scenario involving an enterprise knowledge base that looks normal on the surface but hides agent instructions):

dsh-phishing-guard --demo

List all rules and criteria:

dsh-phishing-guard --list-rules

Generate an HTML report:

dsh-phishing-guard --root /path/to/knowledge-base --html report.html

Exit code: Returns 1 when 🔴 level hits exist, making it easy to hook into a “content ingestion” gate.

In the --demo example, you will see things such as: exfiltration URL directives in employee handbooks, zero-width characters between words in FAQs, unrestricted assistant rhetoric in JSON knowledge bases, directives following white-on-white text in HTML templates, and English injections following system: in prompts/assistant.md—humans often cannot see these when opening the file directly, but an agent reading the text may execute them.

Applicable Scenarios and Boundaries

Suitable for: Performing a static screening step before ingesting RAG knowledge bases, external document imports, customer service script templates, and scraped web pages; when paired with dsh-content-trust and dsh-agent-policy from the same “AI and Agent Governance” series, the chain is more complete.

Boundaries (Explained in README):

  • Quotation vs. Real Directives: Chinese book title marks, curly quotes, and backticks touching the content may be treated as quotations and not reported; ASCII double quote quotations (especially in .json) may still hit, which is an intentional trade-off.
  • “I am an administrator” appearing alone is not reported; it must be on the same line as urgency words; splitting rhetoric across lines may result in missed detection.
  • HTML rules like white-on-white text mainly apply to .html / .htm; hidden paragraphs in Markdown with embedded HTML do not go through those two HTML rules, but invisible character and other pattern rules may still hit.
  • Static Check: Images, PDFs, text assembled by JS at runtime, and font rendering hiding are invisible.
  • Patterns are primarily focused on Chinese and English; if your own maintained system prompt template hits PHISH-ROLE-MARKER, manual confirmation is required to see if it is expected content.

Conclusion

dsh-phishing-guard separates “the words the agent reads” from “what looks normal to humans,” using 9 reproducible rules to perform pre-ingestion checks, rather than replacing runtime policies or code audits. For trial usage or directory information, see the community directory skillhub.cn/plugins/feely0208/dsh-phishing-guard; for source code, demos, and development testing instructions, see github.com/feely0208/dsh-phishing-guard.

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

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

Xiaoye