dsh-context-mode
github.com/52sujiu/dsh-context-mode
v0.5.3
会话与记忆
以 shell 执行命令可执行外部程序写入文件
Expose context-mode MCP tools as native DeepSeek Harness tools
该插件尚未翻译,显示作者原文。
dshdsh-tuicontext-modemcpcontext-windowcode-executionfts5
检测报告
关注度高。命中了不少能力模式,其中可能有需要留意的。逐条看下面的清单。
2高关注4需留意5一般13未命中
高关注需留意一般
能力清单
- 以 shell 执行命令
shell-exec高关注32 处命中…xt-mode/src/session/analytics.ts:1891const out = execFileSync("defaults", ["read", "-g", "AppleLocale"], {vendor/context-mode/src/cli.ts:275* - shell: true required (Node v20+ CVE-2024-27980 mitigation)vendor/context-mode/src/cli.ts:281execFileSync(isWin ? "npm.cmd" : "npm", args, {vendor/context-mode/src/cli.ts:283...(isWin ? { shell: true } : {}),- 看命令字符串是拼出来的还是写死的。拼接用户输入才是真正的风险。
- 可执行外部程序
spawns-processes高关注11 处命中lib/types/mcp-client.js:7import { spawn } from 'node:child_process';…xt-mode/src/session/analytics.ts:12import { execFileSync } from "node:child_process";vendor/context-mode/src/cli.ts:19import { execFileSync, execSync, execFile as nodeExecFile, type ExecSyncOptions } from "node:child_process";…r/context-mode/src/session/db.ts:14import { execFileSync } from "node:child_process";- 看它调用哪些程序。调用本机已有的工具是常见做法。
- 写入文件
writes-files需留意42 处命中lib/types/output-containment.js:65mkdirSync(spillDir, { recursive: true });lib/types/output-containment.js:66writeFileSync(path, text, 'utf8');package.json:51"clean": "node -e \"require('node:fs').rmSync('lib', { recursive: true, force: true })\""vendor/context-mode/src/cli.ts:1321rmSync(tmpDir, { recursive: true, force: true });- 看写入位置。写自己的配置目录是正常的,写系统目录不是。
- 可终止进程
kills-processes需留意6 处命中…dor/context-mode/src/executor.ts:205process.kill(-proc.pid, "SIGKILL");…dor/context-mode/src/executor.ts:276process.kill(isWin ? pid : -pid, "SIGTERM");…ext-mode/src/util/sibling-mcp.ts:34/** Inject `process.kill(pid, 0)` for tests. */…ext-mode/src/util/sibling-mcp.ts:37/** Inject `process.kill(pid, signal)` for tests. */- 看它终止的是自己启动的进程,还是按名字匹配到的任意进程。
- 发起网络请求
network需留意4 处命中vendor/context-mode/src/server.ts:3043// chain manually so every hop runs through classifyIp before the next fetch.vendor/context-mode/src/server.ts:3048const resp = await fetch(currentUrl, { redirect: 'manual' });vendor/context-mode/src/server.ts:3169* Pure fetch step — TTL cache check + subprocess fetch. SAFE TO RUN IN PARALLEL.vendor/context-mode/src/server.ts:3462- You want a long-lived cache window (override \`ttl\` upward for stable specs) or a guaranteed-fresh fetch (\`ttl: 0\` …- 看请求发往哪些域名。发往作者自己的后端是常见做法。
- 启动伪终端
spawns-pty需留意4 处命中vendor/context-mode/src/runtime.ts:100const out = execSync(`where ${cmd}`, { encoding: "utf-8", stdio: "pipe" });vendor/context-mode/src/runtime.ts:119execSync(`"${cmd}" --version`, { stdio: "pipe", timeout: 5000 });vendor/context-mode/src/runtime.ts:201const result = execSync("where bash", { encoding: "utf-8", stdio: "pipe" });vendor/context-mode/src/server.ts:121? spawnSync("cmd.exe", ["/d", "/s", "/c", "codex plugin list"], {- 伪终端等于给了一个完整 shell。确认这是插件的核心功能。
- 读取文件
reads-files一般170 处命中lib/types/index.js:205const content = readFileSync(new URL(`../../${skill.path}`, import.meta.url), 'utf8');lib/types/index.js:280if (!existsSync(candidate))lib/types/index.js:294if (existsSync(bundled))scripts/cleanup-injected.mjs:37if (!existsSync(dbPath)) {- 读文件是绝大多数插件的正常工作方式,本身不构成顾虑。
- 读取环境变量
reads-env一般75 处命中lib/types/index.js:152...process.env,…xt-mode/src/session/analytics.ts:1882const env = (process.env ?? {}) as Record<string, string | undefined>;…xt-mode/src/session/analytics.ts:2003process.env.PI_CONTEXT_MODE_PRICE_OUTPUT_PER_TOKEN !== undefined;…xt-mode/src/session/analytics.ts:2004const modelId = process.env.PI_CONTEXT_MODE_MODEL_ID;- 环境变量里常混有密钥。看它是否把整个 env 都读走。
- 动态加载模块
dynamic-import一般29 处命中vendor/context-mode/src/cli.ts:184await import(pathToFileURL(join(pluginRoot, scriptPath)).href);vendor/context-mode/src/cli.ts:260import("./server.js");vendor/context-mode/src/cli.ts:288// Issue #511: use top-level static import (line 17) — never inline `require("node:...")`vendor/context-mode/src/cli.ts:291// Cast preserves the prior `require()`-as-`any` shape; `shell: true` is the documented- 动态导入本身无害,但会让依赖关系难以静态审阅。
- 接触凭据或密钥
credentials一般23 处命中skills/ctx-index/SKILL.md:44- Do not index dependency directories, build outputs, secrets, or generated artifacts.…text-mode/src/session/extract.ts:838// Sanitize export commands to prevent secret leakage…text-mode/src/session/extract.ts:986* Keys whose VALUES must be redacted before persisting tool_input — secrets,…text-mode/src/session/extract.ts:987* tokens, credentials, signatures. Match is on the LAST path segment of the- 看它读取哪些凭据、发往哪里。用于登录自己的服务是正常的。
- 文中出现远程脚本地址
remote-url-reference一般3 处命中vendor/context-mode/src/cli.ts:748"\n Or: curl -fsSL https://bun.sh/install | bash && bun add -g context-mode",vendor/context-mode/src/runtime.ts:622" Tip: Install Bun for 3-5x faster JS/TS execution → https://bun.sh",vendor/context-mode/src/server.ts:5037console.error(" curl -fsSL https://bun.sh/install | bash");- 只是文本里出现了远程脚本地址,没有看到加载它的调用。多半是文档或注释;若确实可疑,搜一下这个地址在包里的其他出现位置。
逐条扫描明细
| 能力 | 标识 | 关注度 | 命中次数 |
|---|---|---|---|
| 以 shell 执行命令 | shell-exec | 高关注 | 32 |
| 可执行外部程序 | spawns-processes | 高关注 | 11 |
| 写入文件 | writes-files | 需留意 | 42 |
| 可终止进程 | kills-processes | 需留意 | 6 |
| 发起网络请求 | network | 需留意 | 4 |
| 启动伪终端 | spawns-pty | 需留意 | 4 |
| 读取文件 | reads-files | 一般 | 170 |
| 读取环境变量 | reads-env | 一般 | 75 |
| 动态加载模块 | dynamic-import | 一般 | 29 |
| 接触凭据或密钥 | credentials | 一般 | 23 |
| 文中出现远程脚本地址 | remote-url-reference | 一般 | 3 |
这份报告的口径
扫描读的是包里的源码,全程不执行第三方代码。 本次读了 68 个文件,扫描于 2026-10-15。 命中次数只说明源码里出现过这类调用,不说明行为好坏——一个插件读写文件 500 次和 1 次 都会被记为「读取文件」。这是能力清单,不是信任评分,也不是安全结论: 没扫出来的能力可能只是写法没被规则覆盖。
依赖安全公告
已查询这个插件声明的全部依赖,没有匹配到已公开的安全公告。(含 DSH 框架包在内的 @deepseek-ai/* 不作查询——那是运行时自己的问题,不是插件的。)