feat: add DSH plugin security scanner - #116
Conversation
AgentGuard PR ReviewI found several actionable issues in the DSH scanner patch.
|
|
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 AgentGuard for DeepSeek Harness (DSH): a read-only Phase 1 installation-time scanner for plugins, bundles, profiles, client extensions, active agent instructions, and Cordis composition.
The new
agentguard dsh-scancommand and nativeagentguard_dsh_scanDSH tool accept a local directory or an HTTPS GitHub repository and produce explainable JSON, Markdown, or self-contained HTML reports. Scanned packages are never installed or executed, lifecycle scripts are not run, and Cordis!!jsvalues remain inert data.Phase 1 boundary
This PR is an installation decision aid, not a DSH runtime firewall. It does not intercept commands, automatically block plugin behavior, resolve npm names/tarballs, or prove that a repository matches a published package. Runtime attribution and per-plugin allow/warn/approve/block enforcement remain Phase 2 work.
Risk-rule semantics are frozen at
83db977for thephase1-rc1baseline. Later commits add regression infrastructure and documentation rather than tuning outcomes to individual plugins.User interfaces
Native DSH installation:
DSH then exposes the read-only
agentguard_dsh_scantool. Critical CLI reports return exit code 2; lower risk levels return 0, while automation can apply stricter policy to JSON fields.Architecture and report model
dsh.bundle.patch,dsh.profile.bundles,dsh.client, current standalone manifests, and Cordis files.!!jsinert.reviewPriority, installation recommendations, artifact hash, Git revision, and project diagnostics.occurrenceCountwithout changing severity.schemaVersion: 1JSON plus portable Markdown and escaped standalone HTML.Detection calibration
DYNAMIC_MODULE_LOADING; only remote acquisition combined with execution uses CRITICALREMOTE_LOADER.DYNAMIC_CODE_EXECUTION; encoded/packed indicators remainOBFUSCATION.AUTO_UPDATErequires nearby acquisition and install/execute evidence instead of file-wide keyword co-occurrence.data/orassets/remain reviewable so directory names cannot hide behavior.Security properties
Phase 1 RC regression baseline
Two complementary gates are included:
dsh-deep-whale— MEDIUM full / LOW runtimesuperdesign-skill— HIGH full / MEDIUM runtimedsh-open-in-vscode— HIGH / HIGHdsh-vision-router— CRITICAL / CRITICAL / URGENTMisakaNet— CRITICAL / CRITICAL / URGENTnpm run benchmark:dshexits non-zero with field-level differences when current results diverge from the committed snapshot. Snapshot updates require a documented scanner change and human review of new or removed HIGH/CRITICAL runtime tags.Manual source reviews document important qualifications: expected guarded self-update behavior in vision-router, generated dependency execution in open-in-vscode, real webhook/keyring/subprocess capability plus sensitive historical material in MisakaNet, and superdesign as a clean runtime control. The notes deliberately do not reproduce credential values.
Validation
npm run buildnpm test— 466 passed, 0 failednpm run test:dsh-e2e— real profile composition, temporary loopback boot, and installed tool execution passednpm run benchmark:dsh— 5/5 exact-commit cases stablegit diff --checkKnown limitations
.eval()method versus language-leveleval).Documentation
docs/dsh.md— architecture, report contract, risk model, operations, and limitationsdocs/dsh-phase1-rc.md— frozen boundary and acceptance gatesbenchmarks/dsh/README.md— exact-commit benchmark and snapshot-update policybenchmarks/dsh/manual-reviews.md— source-level review conclusionsReview history
Earlier automated review findings were addressed across the branch: development-path evidence is preserved, Cordis parsing is bounded and structured, malformed manifests produce diagnostics, GitHub scans verify exact resolved revisions, output directories are created safely, and patch overrides derive from parsed rows rather than free-form snippets. The current PR has no unresolved line-level review comments.