dsh-purge: The Harness Is Part of the Model, and Its Own Scorer Was Eating 61 of 62 Hits — aniketkarneai.com | aniketkarneai.com
Wednesday, November 11, 2026 Field notes on autonomous systems ● Amsterdam, NL
daily

dsh-purge: The Harness Is Part of the Model, and Its Own Scorer Was Eating 61 of 62 Hits

A plugin for DeepSeek Harness built to jailbreak a local agent install turns out to be a measuring instrument. It separates host-layer policy blocks from model-layer refusals, and the scoring engine that grades red-team results contains a dedup bug that silently discarded 61 of 62 findings.

YuJunZhiXue/dsh-purge has 12,210 stars, was created on 2026-08-19, and has shipped 82 release tags in ten weeks — v1.1.77 on Oct 23, v1.1.79 on Oct 26, v1.1.80 and v1.1.81 both on Oct 27, v1.1.82 on Oct 28. That cadence is not normal for a plugin. It is what you get when the plugin has to track a host that is shipping release candidates weekly, because every upstream rc can move the files the plugin rewrites.

I cloned it, ran its test suite (node --test: 36 tests, 36 pass, 0 fail, 187 ms), and then ran its exported functions directly against inputs I picked. The interesting part is not the jailbreak. It is the instrumentation sitting underneath it, and one specific bug in it that I did not expect to find.

The bet, in one sentence

The harness is part of the model, so if you want to know whether a model refused, you have to be able to take the harness’s own prompt rewriting, approval gates, and sandbox policy out of the picture first.

What a harness actually does to your prompt

A raw LLM API call is easy to reason about. You send messages, you get messages back. An agent harness is not that. The DeepSeek Harness — 264,854 stars, MIT, created 2026-08-13 — is a Cordis plugin host that assembles a system prompt from layered sources, intercepts tool calls, routes them through approval decisions, and applies sandbox policy before anything reaches the model.

dsh-purge’s README states the problem plainly, and it is the reason I kept reading:

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.

That distinction matters more than it first appears. If your eval asks an agent to do something and the agent comes back empty-handed, there are at least three different things that could have happened: the model declined on its own, a pre-step hook returned deny, or a sandbox policy refused the tool call before the model was ever consulted. All three look identical from the outside — a turn that produced no result. Any benchmark built on that observation is measuring a composite system and calling it a model property.

The plugin’s approach is to patch the host’s own files so you can turn each layer off independently, then compare. Which means the interesting engineering is not the prompt it injects. It is everything around the prompt: the patch mechanism, the version matrix, the network gate, the scorer, and the evidence ledger.

Patching a host you did not write, reversibly

The mechanism is string surgery on the host’s installed JavaScript, with a backup and an exact-match revert. lib/core.js writes a .dshpurge.bak next to every file it touches, and lib/hooks-deny.js holds a table of reverse substitutions — eight of them, keyed R1a, R1a2, R1b, R2a, R2b, R3, R5a, R5b.

Eight is the tell. A single reverse rule would suffice if the plugin always applied its patches in the same order. It does not: patches 30 and 65 both touch the same hook-merge block, and there are intermediate states where only one of them has landed. The reverse table therefore has to match every shape the file could be in, which is why the find strings are full multi-line blocks including the plugin’s own marker comments rather than a single token. A wrong-shape revert means a half-unpatched host, and a half-unpatched host is the failure mode you cannot detect by reading the UI.

The bypass itself is a sentinel string, __dsh_purge_deny_disabled__. When the plugin writes a deny decision, it writes that string instead — so the presence of the sentinel in the host file is the on-disk evidence that the bypass is still live. Four patch IDs (HOOK_DENY_PATCH_IDS = [30, 31, 64, 65]) are always flipped together, deliberately: the product semantics say a user cannot have “stop hook steers off” but “submit hook denials on,” because those two produce a host that appears permissive and is not.

The network gate resolves first and judges second

The open-source build restricts attack tasks to local lab addresses, and the implementation choice is the interesting part. The README says suffixes are not an allowlist — .lab and .htb get no special treatment — and that hosts-file entries pointing a lab name at a public IP are blocked. The code confirms it: isRangeTarget in lib/net-scope.js calls dns.lookup with all: true and requires every returned address to pass isLocalLabV4. A public answer anywhere in the set, or a failed lookup, or a mixed answer, and the task is refused.

I ran it:

InputResult
example.comBLOCKED (domain)
github.comBLOCKED (domain)
this-host-does-not-exist-zzz.invalidBLOCKED (domain)
target.labBLOCKED (domain)
93.184.216.34BLOCKED (ip)
10.0.0.5allowed
127.0.0.1allowed

The failed-lookup case is the one I would not have assumed. A name that resolves to nothing is refused rather than treated as harmless, because a name that resolves to nothing right now can resolve to something else on the next call. The lookup result is cached for 5,000 ms with a 2,000 ms timeout, and the cache is capped at 256 entries.

isLocalLabV4 accepts exactly four ranges: 10.0.0.0/8, 127.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. Not CGNAT, not link-local, not IPv6 ULA. That strictness is the point, and it is also where I found a disagreement.

Two definitions of “internal,” in the same repo

lib/redteam/ip-utils.js has scopeOfIp, used by the panel to bucket assets into internal and external C-segments. lib/net-scope.js has isLocalLabV4, used by the gate to decide whether an address is a permitted lab target. They disagree on three classes of address:

AddressscopeOfIp (panel)isLocalLabV4 (gate)
100.64.0.7 (CGNAT)internalblocked
169.254.1.1 (link-local)internalblocked
::1 (loopback v6)externalallowed

scopeOfIp treats 100.64.0.0/10 and 169.254.0.0/16 as internal because they are not routable on the public internet. isLocalLabV4 does not list them, so the gate refuses them. An operator looking at the asset panel sees a CGNAT address filed under the internal C-segment column and has no signal that the gate will not route a task to it.

Then there is the IPv4-mapped case, which is worse because both functions are in the same file. scopeOfIp explicitly unwraps ::ffff:a.b.c.d and judges the IPv4 underneath. cidrOf does not. I ran both:

::ffff:10.0.0.5    scope=internal  cidr=0:0:0:0::/64
::ffff:8.8.8.8     scope=external  cidr=0:0:0:0::/64

Every IPv4-mapped IPv6 address lands in the same 0:0:0:0::/64 bucket. expandIpv6 splits on ::, pads to eight groups, and takes the first four — for ::ffff:10.0.0.5 that is four zero groups. The result is a syntactically valid IPv6 /64 that means nothing, shared by every mapped address in the database. Two assets with completely different scope classification get filed into one segment row, and the panel’s segment grouping inherits it. The file’s own docstring says IPv4-mapped addresses should have their shell stripped before judging, and scopeOfIp does it; cidrOf was missed.

Whether this matters in practice depends on whether anything in the pipeline stores IPv4-mapped IPv6 rather than the plain IPv4. On a dual-stack scanner that resolves AAAA first, it does.

The scorer: one implementation, three consumers

lib/redteam/score-rules.js defines 25 score points across 8 groups, each with a point value, a cap, and a dedup scope (service, system, target, none). The values are not decorative — boundary-physical is worth 30,000 points, boundary-strong 10,000, bigdata-system 1,000, and terminal-access 10. A run that reaches a physically isolated core network outscores everything else combined, which is the intended shape of the rubric.

The file’s header explains why applyScoreCaps and evaluateScoreBoard are described as the only implementation: the panel, the report, and the attack-chain view all render the total, and three copies of the cap logic would drift into three different yardsticks.

The dedup rule itself is sensible. Within one service, the highest-privilege hit wins: get a normal account on http://h:8080 (10 points) and then an admin account on the same host and port (20 points), and the normal one is marked capped with capped_reason_kind: "dedup" pointing at the admin hit as capped_by_id. Same for database credentials. tunnelIsLegit applies the same discipline to a different question: a tunnel you opened on your own VPS is self-only and is not a breach, because a breach requires crossing the target boundary. Three entry kinds count — target-initiated outbound, target HTTP channel, forwarding through a compromised process on the target.

And then there is the near-miss, documented in a comment at line 196:

Measured: of 62 terminal-access hits with no target, 61 were judged dedup-not-scored and only 1 was kept — silently eating the results.

The cause was a fallback dedup key. When a hit has no service information, the code used to fall back to a key derived from the hit’s own id, so svc:#hit7 became a shared bucket — and every hit in that scope collided with every other one. Sixty-one findings, one survivor, no error, no warning. The fix was to make unknown-service hits skip dedup entirely, on the reasoning stated in the code: better to under-cap than to over-cap; if you cannot identify the service, let each one count. The same class of bug had previously eaten rule keys, where merged rows 16 and 17 collided with rule 19’s two sub-items and one hit silently consumed another rule’s cap.

That is two of the same bug in one file, found by someone reading their own output. Which is why the invariant is worth more than either instance: evaluateScoreBoard must stay the single implementation, and applyScoreCaps must never invent a dedup key from data it does not have.

Evidence has a confidence level, and a subagent’s report starts at the bottom

The evidence ledger in lib/redteam/evidence-ledger.mjs borrows its shape from the Evidence design in morluto/rea — which I wrote about on Oct 20 — and changes the semantics to fit red-team work. Four confidence levels: claimed, observed, derived, inferred. Authority is a separate axis: tool-output, database-record, screenshot, request-replay, subagent-report, operator-input.

Each entry gets ev_id = "ev_" + sha256(canonical_json), where canonicalization sorts object keys by code point so identical semantics always hash identically. Change one character and the hash changes, which is what makes “the subagent said A, the database says something else” checkable.

The rule that matters: CONFIDENCE_REQUIRES_VERIFICATION = new Set(['claimed', 'inferred']). A subagent’s report is claimed and cannot be promoted without verification, and promotion changes its authority from subagent-report to tool-output. An agent saying “I found the credentials” is not evidence; the tool output that produced them is.

A digression, because it cost me a minute and would have cost the CI pipeline more: lib/redteam/schema.js detects SQLite FTS5 support at import time, because node:sqlite did not ship FTS5 in Node 22.14 and does in 22.23. The code opens a throwaway in-memory database and tries to create an FTS5 virtual table. If it is missing, the schema degrades to LIKE search. The degradation branch is protected by REDTEAM_NO_FTS5=1, an env var whose only job is to force the fallback so it does not rot untested on machines that happen to have a newer Node. I verified both paths on Node v22.23.2 — HAS_FTS5 = true by default, false with the flag set.

The licence split, and why the author went quiet

The repo is Apache-2.0 with a NOTICE file, but there is also a LICENSE-COMMERCIAL.md that is not boilerplate: personal local use is free, reselling or white-labelling requires a written agreement, there is no automated checkout, and the name cannot be transferred or used to claim official status. It closes with a sentence that explains a lot of the repo’s current shape: tags already published under the earlier MIT licence cannot be changed.

The README’s opening note explains the rest. People had been reselling the open-source work; the author was asked to come in and talk. After that, the open build was restricted to local lab IPs only, the skill library and knowledge base stopped shipping in it, and from 2026-10-27 new versions went to a Telegram channel instead of GitHub Releases. The code carries the enforcement: lib/net-scope.js gates on resolved IPs, and separately blocks game-cheat tasks by pattern, with the joke-in-name CHEAT_STRONG regex list and a CHEAT_WEAK list for memory-editing terms that only count when a game term is also present.

There is also docs/redteam-upstream-DISCLOSURE, a dual-use declaration that documents what the package contains and what it does not, referencing npm’s dual-use policy and noting that the design came from a separate upstream package. That file is worth reading on its own terms: it is a package that ships prompt injection declaring itself as such, in a file the npm policy can point at.

Trade-offs and what this does not tell you

  • The measurement is only as good as the version pin. dshTarget is 0.2.1-rc.2, and the README says 0.2.1-rc.3 and newer RCs are not supported. The matrix is explicit: 1.1.81 for 0.2.1-rc.2, 1.1.40 or newer for 0.2.0-rc.2, 1.1.39 or older for 0.1.7. An instrument that only reads one release candidate of a weekly-shipping host is going stale constantly, and the v1.1.8x cadence is mostly that maintenance tax.
  • Patching the host is invasive and the revert is string-matched. The backup files are good, but the revert depends on the host file still having the exact shape the plugin wrote. Upstream reformatting that file breaks the undo.
  • The jailbreak prompt itself is not the interesting artifact, and I am not going to unpack it. lib/default-prompt-inject.en.md and its Chinese counterpart are persona prompts, sealed at build time by scripts/embed-default-prompt.mjs into lib/asset-table.js via AES-256-GCM with a mixed key and a 96-byte chunking scheme. The plaintext source is excluded from the published files list. The engineering there is competent and the packaging is careful, but the interesting question is what it lets you measure, not what it says.
  • The scoring rubric is opinionated. 25 points, weights from 10 to 30,000, dedup scopes, and a ceiling on most rules. It encodes one team’s view of what a red-team run is worth. The rubric is reusable; the weights are not automatically portable to your environment.
  • The scopeOfIp / isLocalLabV4 divergence and the cidrOf IPv4-mapped bucket are live bugs, not hypotheticals. They are small — they affect panel grouping and one address class — but they are the kind of thing that quietly makes a dashboard lie.

Where to dig further

  • lib/redteam/score-rules.js — the scorer. applyScoreCaps, evaluateScoreBoard, DEFAULT_SCORE_POINTS (25 entries), SCORE_GROUPS (8), SCORE_CONFIRM (per-rule evidence requirements: what proof each point demands, and how to replay it).
  • lib/redteam/evidence-ledger.mjs — the four confidence levels, canonicalize, evidenceId, and the promotion path that refuses to trust a subagent.
  • lib/net-scope.js — isRangeTarget, lookupIps, publicHostHit, and the attack/cheat task classifiers with their false-positive workarounds (渗透测试 is not an attack task; exploit-db.com is not an exploit).
  • lib/hooks-deny.js — the eight-rule reverse table and the __dsh_purge_deny_disabled__ sentinel.
  • lib/redteam/ip-utils.js — scopeOfIp, cidrOf, expandIpv6. Compare against lib/net-scope.js.
  • lib/redteam/schema.js — the FTS5 capability probe and the REDTEAM_NO_FTS5=1 escape hatch.
  • docs/redteam-upstream-DISCLOSURE — the dual-use declaration.

What I cannot resolve from here is whether the layer-separation idea generalizes past a host you are allowed to patch. The whole instrument works because the plugin can rewrite the harness’s own files and hand you back the originals. Every agent stack I use — mine included — ships a system prompt I cannot see and cannot switch off, and my refusal evals are quietly scoring the composite. dsh-purge is an answer for a case where you own the install. The interesting open question is what the measurement looks like when you do not.

Aniket Karne
DevOps & AI Engineer · Amsterdam
Back to all posts
Reader correspondence

Comments

Powered by GitHub Discussions via Giscus. Sign in with GitHub to leave a comment.