Introduction¶
The philosophy of DSH is “everything is a plugin”. Plugins run within the current DSH process’s permissions, so it’s necessary to check the source code, dependencies, manifest, and potential external connection behaviors before installation. The community directory is an independent site, with no official affiliation to DeepSeek or幻方; the verified=true in the directory page only indicates that dshbase CI can install it, which is not equivalent to a security audit conclusion.
@shaoshi/dshscan addresses this type of problem: it consolidates plugin source code, dependencies, DSH manifest, and DSH-specific attack surfaces into a single scan, outputting a report with severity levels and evidence, making it easy to assess before installation or for batch inspections.
What is this¶
@shaoshi/dshscan is a DSH plugin security scanner, maintained by shaoshi20, licensed under MIT.
It supports dual-channel checks with static and semantic analysis, includes built-in DSH-specific attack surface rules, integrates npm audit, supports batch scanning, and outputs HTML reports with severity levels and evidence.
Core Features¶
- Input forms: plugin name, GitHub repository URL, local directory, zip file, Markdown file.
- Output report: JSON report includes
risk_score,severity,safe_to_install,recommendation,findings. - Dual-channel scanning: Static rule scanning can be fully offline; optional LLM semantic scanning requires setting
DSCAN_LLM_API_KEYorOPENAI_API_KEY. - dshbase integration: When inputting a plugin name, it automatically reads local index metadata.
- npm source scanning: For npm plugins, it can automatically
npm packto download and scan package contents. - Dependency audit: Checks for unlocked versions, remote dependency sources, dependency name spoofing, and integrates npm audit.
- DSH manifest validation: Checks
dsh.bundle,cordis.patch.yml, LICENSE, README. - DSH attack surface rules: R010 plugin tree injection, R011 client-side malicious code, R012 profile tampering, R013 manifest obfuscation, R014 remote dynamic loading, R015 built-in tool shadow hijacking.
- Benchmark evaluation set: Includes built-in malicious/benign samples, can output recall rate, false positive rate, F1 score, and per-rule metrics.
- Custom rules: Supports
--rules <file>. - Policy file: Supports
--policy <file>. - Audit log: Supports
--audit-log <file>. - Web Dashboard: Supports
--serveto launch a local visualization panel, can use--historyto specify a history file. - HTML report: Supports
--htmlto output a standalone web report. - False positive handling: Each finding includes evidence and remediation suggestions.
- Batch scanning: Supports scanning the dshbase plugin directory and outputting summary JSON/HTML.
- Scheduled inspections: Can be combined with GitHub Actions to automatically pull the dshbase directory daily and perform batch scans.
Installation and Enabling¶
Install as a DSH plugin:
dsh plugin add @shaoshi/dshscan
Declared in package.json:
peerDependencies: @deepseek-ai/dsh-tools 0.1.0-rc.6
dependencies: adm-zip ^0.5.16, yaml ^2.9.0
Typical Usage¶
Scanning a Single Plugin¶
dshscan <plugin-name>
When inputting a plugin name, it reads local index metadata.
Scanning Repositories, Local Directories, Zips, Markdown¶
dshscan github:owner/repo
dshscan https://github.com/owner/repo
dshscan /path/to/plugin
dshscan plugin.zip
dshscan README.md
Offline Scanning and Semantic Scanning¶
dshscan <plugin-name> --offline
dshscan <plugin-name> --semantic
Static scanning does not require network access. Scanning GitHub repositories for source code requires network; you can use --offline to skip it. Enabling LLM semantic scanning requires setting DSCAN_LLM_API_KEY or OPENAI_API_KEY.
Outputting Reports¶
dshscan <plugin-name> --output report.json --pretty
dshscan <plugin-name> --summary
dshscan <plugin-name> --html --output report.html
Dependency Audit, Custom Rules, and Policies¶
dshscan <plugin-name> --audit
dshscan <plugin-name> --rules custom-rules.json
dshscan <plugin-name> --policy policy.json --audit-log audit.jsonl
Web Dashboard¶
dshscan --serve --port 8787
dshscan --serve --port 8787 --history /path/to/history.json
Benchmark Evaluation¶
dshscan --benchmark --summary
dshscan --benchmark --pretty
Batch Scanning¶
dshscan --batch --limit 50 --index /path/to/dshbase-directory.json --output batch.json --pretty
dshscan --batch --all --html --output batch.html
dshscan --batch --all --offline --output all.json
Report Determination Explanation¶
In the JSON report, safe_to_install is true only if there are no high/critical findings and risk_score < 40.
When semantic scanning is not enabled, the report will note scan_mode: static and “static scan only, not a complete scan”.
When a report exceeds 100 findings, only the top 100 sorted by severity are displayed, and findings_truncated: true is set; the score and installation recommendation are still based on the full set.
If the index file is missing or corrupted, it will not cause a crash; it will automatically degrade to a no-metadata channel and display a message. You can use DSCAN_INDEX to point to the index file.
Scan Scope and Exclusions¶
The following directories are completely excluded from scanning:
.github,.circleci,.gitlabthird_party,vendornode_modules,dist,build
Applicable Scenarios and Notes¶
@shaoshi/dshscan is suitable for:
- Checking plugin source code, dependencies, manifest, and DSH-related attack surfaces before installing third-party DSH plugins.
- Performing batch inspections on plugin directories and outputting summary JSON/HTML.
- Conducting benchmark evaluations of scanning rules to view recall rate, false positive rate, F1 score, and per-rule metrics.
- Performing scheduled scans in GitHub Actions.
Note: DSH plugins run with the current DSH process’s permissions. Before installation, you should check the source code, license, dependencies, and actual behavior. verified=true only indicates that dshbase CI can install it, which is not equivalent to a security audit. When semantic scanning is not enabled, the results are not a complete scan.
Links¶
Directory page:
https://dshbase.com/zh/plugins/shaoshi-dshscan/
GitHub:
https://github.com/shaoshi20/dshscan