feat: add DSH plugin scanning and runtime protection - #116
Conversation
AgentGuard PR ReviewThis patch introduces a few concrete regressions and safety gaps in the new DSH scanner path.
|
|
Addressed all four review items in
Validation after the fixes:
|
|
Additional hardening from the updated review is in
Latest validation:
|
|
The latest review items are addressed in
Final validation for this revision:
|
|
Final deterministic improvements are in
Two review statements refer to code that is no longer present: the current parser does not call Validation at
|
|
Phase 1 RC stabilization is complete in
The PR body now contains the complete Phase 1 boundary, architecture, calibration history, security properties, acceptance gates, benchmark results, and known limitations. Runtime enforcement remains explicitly deferred to Phase 2. |
|
Phase 1 RC delivery follow-up is ready in
Validation after the change:
No Phase 1 detection rule or risk threshold changed in this follow-up. |
|
Release-artifact validation follow-up is ready in The new The first run caught that
Final validation:
No scanner rule, severity, recommendation, or Phase 1 boundary changed. |
|
New findings:
This path accepts an attacker-controlled GitHub repository and performs a shallow fetch and checkout, but there is no limit on repository size, Git object count, disk usage, or total downloaded bytes. The later file-count and file-size limits only apply after checkout has completed, so a large repository can exhaust network, disk, memory, or CPU before scanning starts. Please add acquisition-level limits, or use a bounded partial/sparse checkout, and abort safely when the repository exceeds the configured budget.
Please use
The Markdown renderer only escapes The HTML renderer escapes these fields, but the Markdown and JSON/tool-output paths still expose them as trusted-looking text. Please escape all untrusted fields and clearly mark artifact content as untrusted data, or return structured fields instead of embedding them into a natural-language report.
When Cordis parsing fails or the file exceeds the parser limits, Please make parse errors and unsupported/truncated Cordis structures raise the review status or minimum risk level. The scanner should not return
Please validate the expected These issues affect the scanner itself rather than the scanned plugin, and could lead to resource exhaustion, local file disclosure, prompt injection, or false-negative security recommendations. |
|
Addressed the five new scanner-self-protection findings in
Validation:
The security baseline is now |
Summary
Add complete AgentGuard support for DeepSeek Harness (DSH): installation-time plugin scanning plus an observation-first, opt-in DSH-native runtime guard.
The scanner evaluates local directories or pinned HTTPS GitHub repositories without installing or executing the target. The runtime integration reuses AgentGuard's shared policy evaluator and connects to DSH's native tool lifecycle, approval service, and audit model. The packaged composition remains non-disruptive in
observe; operators explicitly selectprotectwhen they want enforcement.DSH interfaces
CLI:
Native DSH tools:
agentguard_dsh_scanagentguard_dsh_scan_batchagentguard_dsh_compareagentguard_dsh_runtime_summaryNative installation:
Installation-time scanning
!!jsvalues inert.Incomplete-scan fail-closed behavior (
phase1-rc3)scanCoverage: discovered, scanned, skipped, completeness, and stable skip reasons (fileLimit,oversized,unreadable).DSH_SCAN_INCOMPLETE.expert-review-required; it can never returnsafe-to-try.The pinned real-world benchmark now exercises the bug directly:
dsh-deep-whalecontains a 2.7 MiB runtime asset. It previously appeared LOW at runtime after that file was skipped; it now reportsDSH_SCAN_INCOMPLETE, HIGH, and expert review.The scanner never installs the target, runs lifecycle scripts, or evaluates package/configuration code.
DSH runtime guard
tools/pre-executeandtools/post-executewaterfalls.RuntimeActionmodel.allow/warn/require_approval/blockmonotonically to DSHallow/ask/deny, preserving stronger downstream policies.unknown.Runtime posture visibility
off,observe(audit only; enforcement inactive), orprotect(pre-execute enforcement active), including the configured post-response mode.agentguard_dsh_runtime_summarynow returnsconfiguredMode,preExecuteProtectionActive, andconfiguredPostResponseMode.observeis active protection.The npm bundle composes
observeby default. A profile explicitly opts into enforcement:Acceptance result
The installed complete candidate passed all 11 guided DSH UAT cases: four-tool availability, single and batch scans, report comparison, safe allow, native allow-once approval, rejection with zero execution, hard block with zero execution, redacted runtime summary, malicious-response containment, and Web service stability.
Latest validation for
phase1-rc3:npm run build— passednpm test— 531 passed, 0 failednpm run test:dsh-e2e— passednpm run test:dsh-protect— passednpm run test:dsh-approval— passednpm run test:dsh-post-enforcement— passednpm run test:dsh-lifecycle— passednpm run test:dsh-package— passednpm run benchmark:dsh— 5 exact-commit public-plugin cases stablegit diff --check— passedphase1-rc3UAT — 6/6 passed on 2026-08-19; verified complete-scan compatibility, oversized-file fail-closed behavior, batch propagation, protect/observe visibility, restoration to protect, and HTTP 200Intentional boundaries
unknown.Documentation
docs/dsh.md— architecture, scanner/report contract, operations, and limitationsdocs/dsh-runtime.md— runtime modes, lifecycle mapping, audit, attribution, and containment boundarydocs/dsh-complete-candidate.md— complete candidate contract and acceptance gatesdocs/dsh-user-acceptance-test.zh-CN.md— safe 11-case guided acceptance plandocs/dsh-phase1-rc3-acceptance-test.zh-CN.md— focused incomplete-scan and runtime-mode visibility acceptance plandocs/dsh-phase1-rc3-acceptance-result.zh-CN.md— completed 6/6 installed acceptance evidencedocs/dsh-phase1-rc.md— frozen static scanner baselinesbenchmarks/dsh/README.md— exact-commit benchmark policybenchmarks/dsh/manual-reviews.md— source-level benchmark qualifications