From 94f439d5d166fd96e80049bf8f3a73b49799c928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= Date: Thu, 24 Sep 2026 00:01:41 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=94=B6=E7=B4=A7=20README=EF=BC=8C?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8E=9F=E7=90=86=E6=94=B9=E6=88=90=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- README.md | 348 ++++++++++++++++++++++++----------------------- README.zh-CN.md | 352 +++++++++++++++++++++++++----------------------- 2 files changed, 356 insertions(+), 344 deletions(-) diff --git a/README.md b/README.md index 2d2a8a6..abb04d3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

Version 1.1.14

- Local official DeepSeek Harness cybersecurity red-team plugin: evaluate and harden host safety policy in a controlled local install; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐ + Local official DeepSeek Harness cybersecurity red-team plugin. Evaluate and adjust host safety policy on a controlled local install; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐

@@ -15,9 +15,9 @@ MIT license awesome · DSH plugin DeepSeek Harness Hub - DSH + DSH
- Node.js + Node.js JavaScript

@@ -25,11 +25,37 @@ English | 中文

-> 🌐 **Plugin hub:** [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) — official and community DeepSeek plugin market | discover and one-click install - -> Aligned with **dsh 0.1.5-rc.2** (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. +> Aligned with **dsh 0.1.5-rc.2** (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**. > -> Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**. +> Hub page is for reading only: [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge). Do not install via `deepseek.stream/api/plugins/download?...`. + +## Contents + +- [What this is](#what-this-is) +- [Install](#install) +- [Preview](#preview) +- [Usage](#usage) +- [How it works](#how-it-works) +- [Restore](#restore) +- [Releases](#releases) + +--- + +## What this is + +**dsh-purge** is a cybersecurity red-team plugin for the official [DeepSeek Harness](https://www.deepseek.com/harness/) already installed on your machine. + +Harness does more than forward a prompt. It rewrites prompts, approval gates, sandbox policy, and session migration at runtime. Asking only “will the model answer” treats a host-layer block as a model refusal. This plugin separates those two layers on your own install, for controlled evaluation and for seeing which default policy is too tight. + +| You get | What it does | +|---|---| +| **Rules** | Grouped patch status, Apply / Restore / Uninstall, prompt editor, multiple rule sets | +| **Host policy** | Default copy, permission policy, and tool limits. Official capabilities stay. No second invented identity | +| **On start** | Checks and reapplies. After npm overwrites `node_modules`, you do not hand-edit files | + +No hardcoded drive letters. It looks at `$DSH_HOME`, `.dsh` next to the dsh launcher, then `~/.dsh`. It does not patch the Harness source tree. **Apply** on the settings page is what writes the changes. Identity comes only from your `prompt-inject.md`. + +It only touches the official `@deepseek-ai` packages and local config on the user's machine. It is not a public scanner and not an attack kit for third-party sites. The repo does not ship malware, unauthorized-exploit scripts, or payloads aimed at the public internet. --- @@ -50,18 +76,6 @@ If this project helps you, send it over — I'm out here asking~ --- -## 🛡️ Why cybersecurity red-teaming matters - -As generative AI and large language models move into production, robustness, adversarial defense, and alignment safety are core cybersecurity research problems. A local Agent / Harness also rewrites prompts, approval gates, sandbox policy, and session migration at runtime. Asking “will the model answer” is not enough if the host layer kills a lawful eval request first. - -1. **Map the defense boundary, then harden the guardrail.** Professional cybersecurity red-teaming on a controlled local official DeepSeek Harness install is how teams find guardrail failures, prompt-injection, and unexpected-behavior gaps — then feed those findings back into fine-tuning, input guardrails, and the system safety layer. -2. **Build an offense–defense eval loop.** Defense without a controlled red-team suite is guesswork. Reversible patches on the installed official `@deepseek-ai/*` packages show which refusals come from the model and which come from default copy, approval ladders, or session-format checks — a reproducible ruler for labs and auditors. -3. **Advance native model-security research.** The project aims to give academia and security engineering a transparent, local, reproducible baseline. Keep official capabilities; only adjust over-refusal policy for controlled security eval. No second invented identity, and official optimizations stay. - -This is a **local official DeepSeek Harness cybersecurity red-team plugin**. It only touches **your** installed official `@deepseek-ai` packages and local config. It is **not** a public scanner, **not** an attack kit for third-party sites, and the repo does **not** ship malware, unauthorized-exploit scripts, or payloads aimed at the public internet. - ---- -
@@ -98,27 +112,33 @@ This is a **local official DeepSeek Harness cybersecurity red-team plugin**. It --- -## ⚡ Install +## Install -Web and Desktop are **installed and security-eval patched separately**. They do not touch each other. +Web, community Desktop, and the official desktop EXE are **installed and patched separately**. Install only the host you have open. -| Host | Profile | Default install | +| What you run | Profile | Go to | |---|---|---| -| **Web** (official `dsh web`) | `web` | Official `dsh` on PATH | -| **Desktop** (community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop)) | `desktop` | `dsh` inside the app’s built-in terminal (not official `dsh` on PATH) | -| Official Harness desktop EXE | `default` | Official `dsh`, or `dsh://` below | +| Official `dsh web` | `web` | [Web](#web) | +| Community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `desktop` | [Community Desktop](#desktop) | +| Official Harness desktop EXE | `default` | [Official desktop EXE](#official-exe) | -After install: +If `dsh` is not on PATH, or you do not want a remote install, use [Manual install](#manual). -1. Fully quit and restart **the host you just installed into** (stop `dsh web`, or quit the Desktop tray and open `DSH Desktop.exe`) -2. When **Rules** appears on that host’s Settings page, click **Apply** (adding the bundle does not patch `@deepseek-ai` by itself) -3. On start the plugin auto-applies the current host and uses the built-in default prompt unless the user has saved a different one +### After the command: three steps -Web **Apply / Restart / Uninstall** affect Web only. Desktop **Apply / Restart / Uninstall** affect the desktop app only — they do not launch `dsh web`. +Adding the plugin to a profile does **not** patch `@deepseek-ai` by itself. -> 🌐 **Plugin hub:** [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) (docs only — **do not** install via `deepseek.stream/api/plugins/download?...`) +1. **Quit and reopen** the host you just installed into. Stop `dsh web` and start it again, or quit the Desktop tray and open that app's exe. +2. On **that host's** Settings page, wait until **Rules** appears, then click **Apply**. Ctrl+F5 if the page is cached. +3. **Restart once more** when prompted. Patched files load on that next start. Restart happens only when you click it. -### Web (default) +Web **Apply / Restart / Uninstall** affect Web only. Desktop controls affect the desktop app only and do not launch `dsh web`. Do not Apply one host from the other. + + + +### Web + +Official `dsh` must be on PATH. If it is not, install the official CLI or use manual install. ```sh dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz @@ -130,21 +150,28 @@ If this directory is already a clone: dsh plugin --profile web add . ``` -Then stop `dsh web`, start it again, and **Apply** on the Web Settings page. If `dsh` is not on PATH, install the official CLI or use **Manual install** below. +Then follow the three steps above and click **Apply** on the **Web** Settings page. -### Desktop (default) + -Open community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) and run this in the **built-in terminal** (`dsh` is the desktop wrapper; default profile is `desktop`): +### Community Desktop + +Open [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) and run this in the **built-in terminal**. That `dsh` is the desktop wrapper; its default profile is `desktop`. ```sh dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` -Do not use official `dsh plugin --profile desktop` on PATH (it is rejected). Do not use `dsh://` (that is the official EXE). +Do not use official `dsh plugin --profile desktop` on PATH (it is rejected). Do not use `dsh://` (that protocol belongs to the official EXE). -Then quit the tray, reopen `DSH Desktop.exe`, and **Apply** on the **desktop** Settings page. +Then quit the tray, reopen `DSH Desktop.exe`, and click **Apply** on the **desktop** Settings page. -From a system terminal, use the app’s own CLI. Locate `DSH Desktop.exe` from the running process or the default install locations: +For a custom install folder, set `$exe` in the script to `DSH Desktop.exe` in that folder. The tarball URL is the source so a local path with spaces cannot split the command. + +
+Install from system PowerShell + +Find `DSH Desktop.exe` from the running process or the default locations below. Do not scan the whole disk. ```powershell $zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" @@ -166,13 +193,93 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" & $exe --expose-internals $cli plugin add $zip ``` -For a custom install folder, set `$exe` to `DSH Desktop.exe` in that folder. The tarball URL is the default source so a local path with spaces cannot split the command. +
-### Hand this to an AI (install only) + -Paste the block below to a local coding assistant and ask it to install the plugin. +### Official desktop EXE -
+If the **official DeepSeek Harness desktop client** is installed, use the command or the button (`dsh://`). Community DSH Desktop does **not** handle that protocol — use the previous section. + +```sh +dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz +``` + +

+ 🌐 Open Hub page +  ·  + 🚀 Install in desktop client +

+ +🔗 **Raw protocol URL:** + +``` +dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz +``` + +
+Protocol parameters and web trigger + +**Web trigger example:** + +```js +/** + * Open the DeepSeek Harness desktop client to install dsh-purge + */ +export function installDshPurgeToDesktop() { + const params = new URLSearchParams({ + id: 'dsh-purge', + name: 'dsh-purge', + version: '1.1.14', + repo: 'YuJunZhiXue/dsh-purge', + permissions: '系统提示词注入, 本机补丁, 设置页', + downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', + }); + + const deepLink = `dsh://plugin/install?${params.toString()}`; + + const iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + iframe.src = deepLink; + document.body.appendChild(iframe); + setTimeout(() => document.body.removeChild(iframe), 2000); +} +``` + +**HTML link:** + +```html + + 🚀 Install in desktop client + +``` + +**`dsh://plugin/install` parameters:** + +| Param | Value / example | Meaning | +|---|---|---| +| id | `dsh-purge` | Plugin id | +| name | `dsh-purge` | Display name | +| version | `1.1.14` | Semver | +| repo | `YuJunZhiXue/dsh-purge` | GitHub repo | +| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions | +| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive | + +
+ +Then fully quit the official client, including the tray, open it again, and click **Apply** on its Settings page. + +### How to tell it installed + +- Settings shows the **Rules** card +- `/purge status` in chat prints `DSH_HOME` and the patch list; the path should be the home you are actually running +- Optional packages that are not installed (liangshen, `dsh-web-fetch-http`) show as skipped and do not block Apply + +### Hand this to an assistant + +Paste the block below to a local assistant. It should only run the install command: no full-disk scan, no other file edits, no Apply, no restart. + +
For AI assistants (install only) @@ -233,76 +340,11 @@ After the command finishes, tell the user to fully quit and restart the host the
-### Official desktop EXE (`dsh://`) - -If the **official DeepSeek Harness desktop client (EXE)** is installed, the button below opens a system URI. Community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) does **not** handle `dsh://` — use **Desktop (default)** above. - -CLI equivalent: - -```sh -dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz -``` - -

- 🌐 Open Hub page -  ·  - 🚀 Install in desktop client -

- -🔗 **Raw protocol URL:** - -``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz -``` - -**Web trigger example:** - -```js -/** - * Open the DeepSeek Harness desktop client to install dsh-purge - */ -export function installDshPurgeToDesktop() { - const params = new URLSearchParams({ - id: 'dsh-purge', - name: 'dsh-purge', - version: '1.1.14', - repo: 'YuJunZhiXue/dsh-purge', - permissions: '系统提示词注入, 本机补丁, 设置页', - downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', - }); - - const deepLink = `dsh://plugin/install?${params.toString()}`; - - const iframe = document.createElement('iframe'); - iframe.style.display = 'none'; - iframe.src = deepLink; - document.body.appendChild(iframe); - setTimeout(() => document.body.removeChild(iframe), 2000); -} -``` - -**HTML link:** - -```html - - 🚀 Install in desktop client - -``` - -**`dsh://plugin/install` parameters:** - -| Param | Value / example | Meaning | -|---|---|---| -| id | `dsh-purge` | Plugin id | -| name | `dsh-purge` | Display name | -| version | `1.1.14` | Semver | -| repo | `YuJunZhiXue/dsh-purge` | GitHub repo | -| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions | -| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive | + ### Manual install -Use this when `dsh` is not on `PATH`, official `dsh plugin add` fails, or you do not want a remote install. Edit **only the profile for the host you are using**. Do **not** delete existing bundles. Do not edit Web and Desktop in the same pass. +Use this when the command fails, `dsh` is not on `PATH`, or you do not want a remote install. Edit **only the profile for the host you are using**. Do **not** delete existing bundles. Do not edit Web and Desktop in the same pass. **0. Pick one host, one profile** @@ -465,7 +507,7 @@ Notes: **4. Run `pnpm install` only in the profile you just edited** -`pnpm` must be available (official `dsh` usually ships it). `cd` into **that profile directory**, not the repo root and not `$DSH_HOME` itself. +`pnpm` must be available (official `dsh` usually ships it). `cd` into **that profile directory**, not the repo root and not `$DSH_HOME` itself. Run only the block for your host. Do not run all three. ```sh cd "$DSH_HOME/profiles/web" @@ -544,32 +586,6 @@ Plugin config lives in `cordis.patch.yml`: --- -## What this is - -**dsh-purge** is a settings plugin for [DeepSeek Harness](https://www.deepseek.com/harness/): - -- Updates default copy, permission policy, and tool limits in the installed `@deepseek-ai/*` packages -- Adds a **Rules** card: grouped patches, Apply / Restore / Uninstall, session override editor, multiple rule sets -- Re-applies on start after an npm upgrade overwrites `node_modules` -- No hardcoded drive letters: `$DSH_HOME`, `.dsh` next to the dsh launcher, then `~/.dsh` - -It does not patch the Harness source tree. Use **Apply** on the settings page. Identity comes only from your `prompt-inject.md` — the plugin does not author a second identity card. - ---- - -## 0.1.5 notes - -| Symptom | Patch | What it does | -|---|---|---| -| Picking a workspace / new chat wipes to empty | `#4` `#27` `#38` | 0.1.5 `dsh-persona` requires `prefix`; old presets still send `text`. Alias `text` → `prefix` so 0.1.2 presets (liangshen) can mount | -| History: `summary requires notice form` | `#39` | `dsh-session-format-v0-to-v1` allows mnemon `instructions` / `recall` sources to carry `summary` | -| “Who are you” falls back to DeepSeek assistant | inject file | No second identity. The `dsh-purge` section is verbatim `prompt-inject.md` | -| Liangshen turn 1 looks uninjected | `#28` | phase-1 keeps persona / persona-prefix / persona-suffix plus inject; official tool catalog stays isolated | - -`#20` / `#27` / `#28` remain optional plugin rows: skip if those packages are absent. - ---- - ## Preview The **Rules** card appears on the dsh web settings page. Switch **Light / Ink**. Patches are grouped; the count only includes items that actually applied. Rule sets sit in a list above the editor, with Enable and Delete on each row. @@ -628,17 +644,6 @@ Runtime user files: `$DSH_HOME/prompt-inject.md`, `$DSH_HOME/rules/`, `$DSH_HOME --- -## Verify - -- After restart, the **Rules** card is on the settings page. Hard-refresh (Ctrl+F5) if the client bundle is cached. -- Click **Apply**, then **Restart** when prompted. Optional packages (liangshen / web-fetch) show as missing/skipped and do not block complete → restart. -- Until the user saves a different prompt, `prompt-inject.md` stays the built-in default. -- `/purge status` prints `DSH_HOME` and the patch list. -- On 0.1.5, selecting an existing workspace should restore the session — not wipe to an empty workspace. -- Skipped items are expected when a target file is absent (for example #20 without `dsh-web-fetch-http`). - ---- - ## Usage ```sh @@ -680,38 +685,37 @@ node --check client.js ## How it works -**Apply (on start or by hand):** +Apply, on start or when you click Apply: -``` -patch not applied? ──no──> skip - │yes - ├─> backup .dshpurge.bak (Desktop host-commands backups stay under `$DSH_HOME/dsh-purge/shim-backups` only) - ├─> apply matching replacements - ├─> override shim (dsh.cmd / dsh.ps1 / unix dsh; **skip Desktop sealed host-commands bins**) - ├─> scrub illegal sibling `*.dshpurge.bak` inside sealed bins (Desktop validates before plugins load) - ├─> Windows: pin hide-console + child_process import hook; patch subprocess-local / doctor / market / liangshen bash - └─> if the user has not replaced the prompt, write/refresh the built-in default +```mermaid +flowchart TD + A["Start or click Apply"] --> B{"Patch already in place?"} + B -->|yes| C["Skip"] + B -->|no| D["Back up the original as .dshpurge.bak"] + D --> E["Replace the matched files"] + E --> F["Override the shim"] + F --> G{"User edited the prompt?"} + G -->|no| H["Write the built-in default prompt"] + G -->|yes| I["Keep the current prompt-inject.md"] ``` -**Override (each session):** +Override on each session: -``` -prompt-inject.md has content? ──yes──> write it verbatim as the dsh-purge systemPrompt section - │no - └─> no override section +```mermaid +flowchart TD + A["New session"] --> B{"prompt-inject.md has text?"} + B -->|yes| C["Write it verbatim into the dsh-purge systemPrompt section"] + B -->|no| D["Do not write an override section"] ``` -**Skills (official catalog, not injected):** Settings import (zip or folder) or `/skills import` writes only to official `$DSH_HOME/skills//SKILL.md` (companion files in that folder are kept). Official `dsh-skill-filesystem` watches that directory; the model loads via the `skill` tool or `/id`. Uninstalling the plugin does not delete user skills. +Skills stay out of the inject section: -**Identity (1.3.6):** the plugin does not invent an “operator / LCS” second persona. Official Harness identity lines are stripped; `prompt-inject.md` is the identity. On 0.1.5 the inject is folded into `persona-prefix` so liangshen phase-1 cannot drop it. - -**Windows CMD silence:** on Node 24, `import { spawn } from "node:child_process"` is not a live binding. `registerHooks` redirects `node:child_process` to a `windowsHide` facade; `@deepseek-ai/dsh-subprocess-local` also gets `windowsHide: true`. Doctor relaunch uses `node + bin.js` and does not leave a noop `supervisor.cmd`. - -**Liangshen phase-1:** the default preset strips non-persona system-prompt sections. Apply / startup keeps persona, persona-prefix, persona-suffix, and inject (tool quarantine unchanged). - -**DSH Desktop (anywhere-labs/dsh-desktop, issue #9):** `host-commands//bin` is sealed — no sibling extras (including `dsh.cmd.dshpurge.bak`). This plugin scrubs only (no inject, no bak writes). - -**Prompt security eval:** over-refusal and anti-eval-persona wording in `minimal`, official `standard` / `ptc` / `cordis`, and liangshen personas is rewritten so controlled security evaluations can complete. No fixed role name is locked in. +```mermaid +flowchart LR + A["Settings import or /skills import"] --> B["Write into the official skills directory"] + B --> C["DSH loads it"] + C --> D["Uninstall does not delete user skills"] +``` --- diff --git a/README.zh-CN.md b/README.zh-CN.md index 047220c..47c7040 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -7,7 +7,7 @@

Version 1.1.14

- 本机官方 DeepSeek Harness 网络安全红队评测插件:在受控本机环境评测并加固宿主安全策略,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐ + 本机官方 DeepSeek Harness 网络安全红队评测插件。在受控本机里评测并调整宿主安全策略,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐

@@ -15,18 +15,47 @@ MIT license awesome · DSH plugin DeepSeek Harness Hub - DSH + DSH +
+ Node.js + JavaScript

English | 中文

-> 🌐 **插件生态市场**:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) — DeepSeek 官方与开源生态市场 | 插件发现与一键安装 - -> 对准 **dsh 0.1.5-rc.1**(Node.js **≥18**;Windows 无感路径依赖 **Node ≥22** 的 `registerHooks`,更低版本仍靠文件级 `windowsHide` 补丁)。其它版本原文对不上时会显示待应用 / 跳过,不会乱改文件。 +> 对准 **dsh 0.1.5-rc.2**(Node.js **≥18**;Windows 无闪窗需要 **Node ≥22** 的 `registerHooks`,更低版本仍用文件级 `windowsHide`)。其它版本对不上的原文会显示待应用或跳过,不会乱改文件。兼容 0.1.2 社区预设的 `text` 字段,以及 `dsh-mnemon` 旧会话的 v0 `summary`。装完必须 **应用 + 重启**。 > -> 兼容 0.1.2 社区预设的 `dsh-persona text` 字段,以及 `dsh-mnemon` 历史会话的 v0 `summary`。装完必须 **应用 + 重启**。 +> 插件市场只看介绍:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)。不要用 `deepseek.stream/api/plugins/download?...` 安装。 + +## 目录 + +- [介绍](#介绍) +- [安装](#安装) +- [界面](#界面预览) +- [使用](#使用) +- [工作原理](#工作原理) +- [还原](#还原) +- [更新](#更新) + +--- + +## 介绍 + +**dsh-purge** 是装在本机官方 [DeepSeek Harness](https://www.deepseek.com/harness/) 上的网络安全红队评测插件。 + +Harness 不只是把问题交给模型。它还会在运行时改提示词、审批门、沙箱和会话格式。只看「模型答不答」,会把宿主拦截误当成模型拒绝。这个插件在你自己的安装里把这两层分开,用来做受控评测,也用来看默认策略该不该收紧。 + +| 你会用到 | 它做什么 | +|---|---| +| **规则设定** | 分组查看补丁,应用、还原、卸载;编辑提示词和多套规则 | +| **宿主策略** | 调整默认文案、权限策略和工具上限。官方能力保留,不另写一套身份 | +| **启动时** | 自动再检查并应用。npm 升级盖掉 `node_modules` 之后不用手改文件 | + +不写死盘符。按 `$DSH_HOME`、dsh 启动器旁边的 `.dsh`,再退回 `~/.dsh`。不改 Harness 源码仓库,设置页点「应用」才写入。身份只来自你的 `prompt-inject.md`。 + +本插件只处理使用者本机已安装的官方 `@deepseek-ai` 包和本机配置。它不是公网扫描器,也不是针对第三方站点的攻击套件。仓库内不含木马、未授权渗透脚本或对外攻击载荷。 --- @@ -47,18 +76,6 @@ --- -## 🛡️ 网络安全红队基准评测的必要性 - -在生成式人工智能与大语言模型(LLM)向各行业深度融合的背景下,模型的鲁棒性、对抗防御能力与系统对齐安全性已成为网络空间安全的核心研究课题。本地 Agent / Harness 还会在运行时改写提示词、审批门、沙箱和会话迁移,只测「模型会不会答」不够,还要看宿主层有没有把合法安全评测请求拦截掉。 - -1. **暴露防御边界,反哺安全护栏**:只有通过专业的网络安全红队对抗模拟(Red-Teaming),在受控本机环境深入探查官方 DeepSeek Harness 的防护失效、提示词注入与非预期行为,才能帮助安全团队精确定位防护盲区,从而在模型微调、输入过滤网关(Guardrails)与系统安全层实现前置加固。 -2. **构建攻防一体化防御体系**:缺乏受控红队评测用例的防御如同纸上谈兵。对本机已安装的官方 `@deepseek-ai/*` 包做可回滚安全评测补丁,才能分清哪些拒绝来自模型,哪些来自 Harness 默认文案、审批阶梯或会话格式校验,为企业与安全审计提供可复现的标尺。 -3. **推动大模型原生安全学术发展**:本项目旨在为学术界与安全工程领域提供透明、可复现的本机基准测试基线,共同推动 AI 基础设施抗对抗攻击、对齐与形式化验证技术演进。保住官方能力,只调整过度拒绝策略以便受控评测;不另造第二套身份,不删官方优化。 - -本项目是**本机官方 DeepSeek Harness 网络安全红队评测插件**:只改使用者自己安装的官方 `@deepseek-ai` 包与本机配置,**不是**公网扫描器,**不是**对第三方站点的攻击套件,仓库内**不含**木马、未授权渗透脚本或针对外网的攻击载荷。 - ---- -
@@ -95,53 +112,66 @@ --- -## ⚡ 安装方式 +## 安装 -Web 端和桌面端**分开安装、分开做安全评测补丁**,互不影响。 +Web、社区桌面端、官方桌面 EXE **分开装、分开应用**。只装你正在打开的那一个。 -| 宿主 | profile | 默认怎么装 | +| 你正在用 | profile | 安装 | |---|---|---| -| **Web 端**(官方 `dsh web`) | `web` | PATH 上的官方 `dsh` | -| **桌面端**(社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop)) | `desktop` | 桌面应用自带终端里的 `dsh`(不要用 PATH 上的官方 `dsh`) | -| 官方 Harness 桌面 EXE | `default` | 官方 `dsh`,或下面的 `dsh://` | +| 官方 `dsh web` | `web` | [Web](#web) | +| 社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `desktop` | [社区桌面端](#desktop) | +| 官方 Harness 桌面 EXE | `default` | [官方桌面 EXE](#official-exe) | -装完后都要: +`dsh` 不在 PATH、或不想走远程安装时,用 [手动安装](#manual)。 -1. 完全退出并重启**刚装的那个宿主**(Web 关 `dsh web`;桌面端退出托盘再打开 `DSH Desktop.exe`) -2. 在**这个宿主**的设置页出现「规则设定」后点「应用」(只写入 profile 还不会改 `@deepseek-ai`) -3. 启动后会自动对当前宿主应用安全评测补丁;未自行改过提示词时使用插件内置默认,只有用户自己保存过不同内容才保留 +### 装完都要做完这三步 -Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的「应用 / 重启 / 卸载」只动桌面应用,不会去拉 `dsh web`。 +只把插件写进 profile **还不会**改 `@deepseek-ai`。 -> 🌐 **插件生态市场**:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)(只看介绍;**不要**用 `deepseek.stream/api/plugins/download?...` 安装) +1. **退出并重新打开**刚装的那个宿主。Web 关掉 `dsh web` 再开;桌面端退出托盘,再打开对应的 exe。 +2. 在**这个宿主**的设置页看到「规则设定」,点 **「应用」**。有缓存就先 Ctrl+F5。 +3. 按提示 **再重启一次**。补丁这时才进入当前进程。点「重启」才会重启,不会装完自动重启。 -### Web 端(默认) +Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的只动桌面应用,不会去拉 `dsh web`。不要在 Web 里点桌面端的应用,也不要反过来。 + + + +### Web + +官方 `dsh` 需要在 PATH 上。没有就先装官方 CLI,或改走手动安装。 ```sh dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` -当前目录已是本仓库时: +当前目录已经是本仓库时: ```sh dsh plugin --profile web add . ``` -然后关掉 `dsh web` 再开,在 Web 设置页点「应用」。`dsh` 不在 PATH 就先装好官方 CLI,或走下面「手动配置」。 +然后按上面三步,在 **Web** 设置页点「应用」。 -### 桌面端(默认) + -打开社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop),在**自带终端**里执行(这里的 `dsh` 是桌面包装脚本,默认 profile 就是 `desktop`): +### 社区桌面端 + +打开 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop),在 **自带终端** 里执行。这里的 `dsh` 是桌面包装脚本,默认 profile 就是 `desktop`。 ```sh dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` -不要用 PATH 上的官方 `dsh plugin --profile desktop`(会被拒绝)。不要用 `dsh://`(那是官方 EXE)。 +不要用 PATH 上的官方 `dsh plugin --profile desktop`,这条会被拒绝。不要用 `dsh://`,那是官方 EXE 的协议。 -然后退出托盘,重新打开 `DSH Desktop.exe`,在**桌面端**设置页点「应用」。 +然后退出托盘,重新打开 `DSH Desktop.exe`,在 **桌面端** 设置页点「应用」。 -从系统终端安装时,用桌面端自带 CLI。按正在运行的进程、默认安装位置定位 `DSH Desktop.exe`: +自定义安装目录时,把脚本里的 `$exe` 换成该目录下的 `DSH Desktop.exe`。源用 tar.gz 地址,避免本地路径里的空格把命令拆开。 + +
+从系统 PowerShell 安装 + +按正在运行的进程,或下面三个默认位置找 `DSH Desktop.exe`。不要全盘搜索。 ```powershell $zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" @@ -163,13 +193,93 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" & $exe --expose-internals $cli plugin add $zip ``` -自定义安装目录时,把 `$exe` 换成该目录下的 `DSH Desktop.exe`。默认用 tar.gz 地址,避免本地路径空格把命令拆开。 +
-### 交给 AI 安装(只装插件) + -把下面这一块发给本机助手,让它只执行安装命令。 +### 官方桌面 EXE -
+已经安装 **DeepSeek Harness 官方桌面客户端** 时,用下面的命令,或点按钮走 `dsh://`。社区 DSH Desktop **不认** 这个协议,请回到上一节。 + +```sh +dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz +``` + +

+ 🌐 打开插件市场页 +  ·  + 🚀 唤起客户端一键安装 +

+ +🔗 **原生协议链接:** + +``` +dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz +``` + +
+协议参数和网页触发代码 + +**网页端(前端)触发代码示例:** + +```js +/** + * 唤起 DeepSeek Harness 桌面客户端一键安装 dsh-purge + */ +export function installDshPurgeToDesktop() { + const params = new URLSearchParams({ + id: 'dsh-purge', + name: 'dsh-purge', + version: '1.1.14', + repo: 'YuJunZhiXue/dsh-purge', + permissions: '系统提示词注入, 本机补丁, 设置页', + downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', + }); + + const deepLink = `dsh://plugin/install?${params.toString()}`; + + const iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + iframe.src = deepLink; + document.body.appendChild(iframe); + setTimeout(() => document.body.removeChild(iframe), 2000); +} +``` + +**HTML 静态链接方式:** + +```html + + 🚀 唤起客户端一键安装 + +``` + +**协议参数配置(dsh://plugin/install):** + +| 参数名 | 值 / 示例 | 说明 | +|---|---|---| +| id | `dsh-purge` | 插件唯一标识符 | +| name | `dsh-purge` | 插件展示名称 | +| version | `1.1.14` | 语义化版本号 | +| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 | +| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 | +| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 | + +
+ +然后完全退出官方客户端(含托盘),再打开,在它自己的设置页点「应用」。 + +### 怎样算装上了 + +- 设置页有「规则设定」 +- 聊天里 `/purge status` 能打出 `DSH_HOME` 和补丁列表,路径应是你正在用的那一份 +- 没装的可选包(例如梁神、`dsh-web-fetch-http`)显示跳过,不挡住应用完成 + +### 交给助手安装 + +把下面整段发给本机助手。它只执行安装命令:不要全盘搜索,不要改其它文件,不要代点「应用」,也不要重启。 + +
给 AI 助手(只安装) @@ -230,76 +340,11 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
-### 官方桌面 EXE(`dsh://`) + -已安装 **DeepSeek Harness 官方桌面客户端(EXE)** 时,点下方按钮走系统 URI。社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) **不认** `dsh://`,走上面「桌面端」默认命令。 +### 手动安装 -命令行等价: - -```sh -dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz -``` - -

- 🌐 打开插件市场页 -  ·  - 🚀 唤起客户端一键安装 -

- -🔗 **原生协议链接:** - -``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz -``` - -**网页端(前端)触发代码示例:** - -```js -/** - * 唤起 DeepSeek Harness 桌面客户端一键安装 dsh-purge - */ -export function installDshPurgeToDesktop() { - const params = new URLSearchParams({ - id: 'dsh-purge', - name: 'dsh-purge', - version: '1.1.14', - repo: 'YuJunZhiXue/dsh-purge', - permissions: '系统提示词注入, 本机补丁, 设置页', - downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', - }); - - const deepLink = `dsh://plugin/install?${params.toString()}`; - - const iframe = document.createElement('iframe'); - iframe.style.display = 'none'; - iframe.src = deepLink; - document.body.appendChild(iframe); - setTimeout(() => document.body.removeChild(iframe), 2000); -} -``` - -**HTML 静态链接方式:** - -```html - - 🚀 唤起客户端一键安装 - -``` - -**协议参数配置(dsh://plugin/install):** - -| 参数名 | 值 / 示例 | 说明 | -|---|---|---| -| id | `dsh-purge` | 插件唯一标识符 | -| name | `dsh-purge` | 插件展示名称 | -| version | `1.1.14` | 语义化版本号 | -| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 | -| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 | -| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 | - -### 手动配置安装 - -`dsh` 不在 PATH、官方 `dsh plugin add` 失败、或不想走远程安装时,按下面手工写入。只改**正在用的那个宿主**对应的 profile,不要删原有 bundle,不要同时改 Web 和桌面端。 +命令行装不上、官方 `dsh plugin add` 失败、或不想走远程包时,按下面做。只改**正在用的那个宿主**对应的 profile,不要删原有 bundle,不要同时改 Web 和桌面端。 **0. 先确认宿主,只动一个 profile** @@ -462,7 +507,7 @@ Rename-Item $src "dsh-purge" **4. 只在刚改的那个 profile 目录装依赖** -本机要有 `pnpm`(官方 dsh 一般自带)。进入**上一步改过的那个** profile 目录再执行,不要在仓库根目录、也不要在 `$DSH_HOME` 根目录执行。 +本机要有 `pnpm`(官方 dsh 一般自带)。进入**上一步改过的那个** profile 目录再执行,不要在仓库根目录、也不要在 `$DSH_HOME` 根目录执行。下面三条命令只跑和你宿主对应的一条,不要三个连着跑。 ```sh cd "$DSH_HOME/profiles/web" # Web @@ -541,32 +586,6 @@ dsh-purge --uninstall --- -## 这是什么 - -**dsh-purge** 是 [DeepSeek Harness](https://www.deepseek.com/harness/) 的设置插件: - -- 改本机已安装的 `@deepseek-ai/*` 包:默认文案、权限策略、工具上限; -- 设置页「规则设定」:分组查看补丁、应用 / 还原 / 卸载、编辑会话覆盖、多套规则; -- 启动时自动检查并重新应用(npm 升级覆盖 `node_modules` 之后不必手搓); -- 不写死盘符:按 `$DSH_HOME`、dsh 启动器旁边的 `.dsh`、系统默认 `~/.dsh` 探测本机位置。 - -不改 Harness 源码仓库。设置页点「应用」即可。身份只来自你自己的 `prompt-inject.md`,插件不再另写一张身份卡。 - ---- - -## 0.1.5 适配要点 - -| 现象 | 补丁 | 处理 | -|---|---|---| -| 选工作区 / 开新对话被清空 | `#4` `#27` `#38` | 0.1.5 的 `dsh-persona` 只要 `prefix`;旧预设仍写 `text`。补丁把 `text` 收成 `prefix` 别名,梁神等 0.1.2 预设才能挂上 | -| 历史会话 `summary requires notice form` | `#39` | `dsh-session-format-v0-to-v1` 允许 mnemon 的 `instructions` / `recall` 带着 `summary` | -| 「你是谁」回到 DeepSeek 助手 | 注入文件 | 不发明第二套身份;`dsh-purge` 段只贴 `prompt-inject.md` 原文 | -| 梁神第一轮像没注入 | `#28` | phase-1 保留 persona / persona-prefix / persona-suffix 与 inject,不扒官方工具目录 | - -`#20` / `#27` / `#28` 仍是可选插件项:没装对应包就跳过。 - ---- - ## 界面预览 设置页会出现「规则设定」。白 / 墨可切换。补丁按组展开,进度只计真正已应用的项。规则集在上方列表启用或删除,下方编辑正文。 @@ -625,17 +644,6 @@ dsh-purge/ --- -## 生效验证 - -- 重启后设置页出现「规则设定」卡片(客户端半体加载成功)。有缓存时 Ctrl+F5。 -- 点「应用」,进度里已应用项增加;再按提示重启,补丁进入当前进程。缺可选包(如梁神、web-fetch)时对应项显示跳过/缺失,不影响「完成 → 重启」。 -- 未自行改过时,`prompt-inject.md` 使用插件内置默认提示词。设置页保存不同内容后才换成用户自己的。 -- 聊天里 `/purge status` 能打出 `DSH_HOME` 和补丁列表。 -- 0.1.5 上选已有工作区应能恢复会话,不应被清空成空工作区。 -- 个别项显示跳过是正常的:例如没装 `dsh-web-fetch-http` 时 #20 会跳过。 - ---- - ## 使用 ```sh @@ -676,37 +684,37 @@ node --check client.js ## 工作原理 -**应用(启动时 / 手动):** +应用,启动时或手动点「应用」: -``` -补丁未应用? ──否──> 跳过 - │是 - ├─> 备份原件 <文件>.dshpurge.bak(Desktop host-commands 的 shim 备份外置到 `$DSH_HOME/dsh-purge/shim-backups`) - ├─> 按补丁列表替换对应文件 - ├─> 覆盖 shim(dsh.cmd / dsh.ps1 / unix dsh;**跳过 Desktop host-commands 密封目录**) - ├─> 清掉密封目录里误放的 sibling `*.dshpurge.bak`(Desktop 启动前校验,残留会进恢复模式) - ├─> Windows:钉 hide-console + child_process 导入钩子,并修补 subprocess-local / doctor / market / 梁神 bash - └─> 未自行改过则写入/刷新内置默认提示词 +```mermaid +flowchart TD + A["启动或点应用"] --> B{"补丁已经生效?"} + B -->|是| C["跳过"] + B -->|否| D["备份原件为 .dshpurge.bak"] + D --> E["按补丁列表替换对应文件"] + E --> F["覆盖 shim"] + F --> G{"用户改过提示词?"} + G -->|没有| H["写入内置默认提示词"] + G -->|改过| I["保留现有 prompt-inject.md"] ``` -**覆盖(每次会话):** +每次会话的覆盖: -``` -prompt-inject.md 有内容? ──是──> 原样写入 dsh-purge systemPrompt 段 - │否 - └─> 不写入覆盖段 +```mermaid +flowchart TD + A["新会话"] --> B{"prompt-inject.md 有内容?"} + B -->|有| C["原样写入 dsh-purge systemPrompt 段"] + B -->|没有| D["不写入覆盖段"] ``` -**Skill(官方目录,不注入):** 设置页导入压缩包/文件夹,或 `/skills import`,只把内容写到官方 `$DSH_HOME/skills//SKILL.md`(可带同目录脚本等资源)。官方 `dsh-skill-filesystem` 监视该目录;模型用 `skill` 工具或 `/id` 加载。卸载插件不删用户 Skill。 - -**身份(1.3.6):** 插件不发明「操作员 / LCS」第二套人设。官方 Harness 身份句剥掉;`prompt-inject.md` 原文就是身份。0.1.5 把 inject 折进 `persona-prefix`,避免被梁神 phase-1 滤掉。 - -**Windows CMD 无感:** Node 24 上 `import { spawn } from "node:child_process"` 不是实时绑定。`registerHooks` 把 `node:child_process` 指到带 `windowsHide` 的封装层,并直接给 `@deepseek-ai/dsh-subprocess-local` 加 `windowsHide: true`。doctor 重启走 `node + bin.js`,不写空操作 `supervisor.cmd`。 - -**梁神 phase-1:** 默认预设会扒掉非 persona 的 system-prompt 段。应用 / 启动时保留 persona、persona-prefix、persona-suffix 与 inject(工具目录仍按梁神隔离)。 - -**DSH Desktop(anywhere-labs/dsh-desktop,issue #9):** `host-commands//bin` 是密封目录,禁止 sibling 额外文件(含 `dsh.cmd.dshpurge.bak`)。本插件对密封目录只清理、不注入、不写 bak。 +Skill 不进注入段: +```mermaid +flowchart LR + A["设置页导入或 /skills import"] --> B["写到官方 skills 目录"] + B --> C["由 DSH 加载"] + C --> D["卸载插件不删用户 Skill"] +``` ---