dsh-calibguard: Adding a local gate to external code execution in DSH

Preface

When letting agents install scripts, extract third-party packages, or run downloaded files in DeepSeek Harness (DSH), the common approach is post-incident remediation or relying entirely on model discipline. Once paths or archive sources are unknown, the host process often executes them directly without auditing. The community plugin dsh-calibguard (maintainer maomitgd2006) is introduced below. It connects the file security audit engine of CalibGuard to DSH: by default it runs locally with calibrated CodeBERT to provide interpretable conclusions, and only optionally sends gray-area cases to cloud review. It also offers both an agent tool and a sidebar panel as entry points.

What This Is

dsh-calibguard is an npm-published DSH plugin (package name dsh-calibguard, version 0.3.6 in current materials, MIT license). This repository only handles DSH integration; the audit engine itself resides in CG_GUI/ of the CG project. The plugin invokes the built-in engine/ via a persistent Python subprocess without copying or modifying upstream engine logic.

It is categorized as admin-security. Entries and source code can be viewed on the SkillHub plugin directory and the GitHub repository.

Core Features

Local Gating with Optional Cloud Review

  • Offline by default: Local CodeBERT + Platt calibration outputs “malicious probability” and four-tier conclusions; file contents are not uploaded by default.
  • Cloud only for gray zones: Only when the local judgment is uncertain can a cloud review be initiated once according to settings (can be disabled).
  • Four-tier conclusions: ALLOW, SUSPICIOUS, BLOCK, MANUAL, accompanied by evidence and Markdown report path.

Two Usage Modes

  1. AI tools: calibguard_audit (audit paths), calibguard_status (engine and threshold status).
  2. Sidebar panel: Shield icon; drag files in or paste host directory paths; supports recursive directory auditing (with a clear prompt when a file count limit is reached).

The panel’s “Settings” and AI calls share $DSH_HOME/calibguard-settings.json (default ~/.dsh); API keys use the DSH credential store or local calibguard-credentials.json (depending on DSH version).

Automatic Engine Preparation

After installing the plugin and restarting DSH, if <engineRoot>/.venv is missing (default engineRoot is ~/.dsh/calibguard-engine), the plugin will in the background copy the built-in engine, download approximately 475 MB of model weights from this repository’s Release, create a venv, and install Python dependencies. If no suitable Python is available locally, the installer can automatically fetch portable Python 3.10.8. First-time setup takes about 10–20 minutes and only needs to happen once. When a qualifying NVIDIA GPU is detected, it automatically selects CUDA-enabled torch; otherwise it uses the CPU version.

Installation and Activation

Prerequisites (from the official README): DSH 0.1.5-rc.2 tested and working; Node ≥ 20.

Settings → Add Plugin → enter the package name, then restart DSH:

dsh-calibguard

Pinned version example: dsh-calibguard@0.3.3 (the @ is followed by the version number). You can also enter the GitHub repository URL https://github.com/maomitgd2006/dsh-CalibGuard or a local plugin directory path.

Command Line (Non-Desktop Profiles)

Run in the corresponding profile:

dsh plugin --profile <profile> add dsh-calibguard

Equivalent options include adding a GitHub URL or file:<absolute path to this package>. npm package page: https://www.npmjs.com/package/dsh-calibguard.

The desktop’s desktop profile is exclusively owned by Electron and cannot be managed by the CLI; desktop users should use “Add Plugin” or the file:// method in cordis.patch.yml.

Verification

After restarting, a shield icon appears in the left sidebar, and the panel top displays engine readiness and threshold status; or ask the model to call calibguard_status in a conversation. Self-check without going through DSH:

node scripts/bridge-selftest.mjs

After modifying cordis.patch.yml or panel-related code, DSH must be restarted again.

Typical Usage

Let AI Audit Before Installing

Simply describe paths in natural language; the model will call calibguard_audit:

Audit D:\downloads\setup.py before installing
Is this archive safe? D:\downloads\vendor.zip
Go through suspicious files in the D:\projects\vendor directory

The response includes the four-tier conclusion, calibrated probability p, device (cpu/cuda), sha256, and report path; a single call can also override parameters such as max_files, allow_threshold / block_threshold, llm_enabled, etc., without affecting the global settings saved in the panel.

Manual Panel Audit

Sidebar shield → drag files into the dashed box or paste paths → “Start Audit”. Archives are unpacked in memory and audited file by file; results are sorted by severity, and Markdown reports can be opened.

How to Read Conclusions

Label Meaning Recommended Action
BLOCK Locally high-confidence malicious Do not execute; review report evidence
MANUAL Uncertain or cloud review failed Manually confirm or adjust review criteria
SUSPICIOUS Medium probability Judge based on the report
ALLOW Locally judged safe Proceed with subsequent operations

Use Cases and Notes

Suitable for: Developers who need to perform batch or conversational auditing of downloaded scripts, installation packages, and vendor directories within DSH sessions; who prefer local inference by default and cloud review only for gray-zone cases; who want the panel and agent to share the same threshold and review policy.

Notes:

  1. The plugin runs with the current DSH process permissions and audits host machine paths; please verify the GitHub source code and MIT license yourself before installing.
  2. The first automatic preparation will download models and pip dependencies over the network; for locked-network environments, set autoSetup: false and manually prepare using node setup.mjs or an offline package with --from as described in the README.
  3. SkillHub and similar directories are community directories with no official affiliation to DeepSeek / High-Flyer; plugin star counts and other metadata are based on the directory page (GitHub shows 1 star in current materials).

Closing

dsh-calibguard brings CalibGuard’s local calibrated gating into the DSH toolchain and sidebar, providing interpretable four-tier conclusions and reports before agents execute external files. For entry descriptions, open SkillHub: dsh-CalibGuard; for installation details and advanced configuration, see GitHub: maomitgd2006/dsh-CalibGuard.

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

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

Xiaoye