Is deepseek-ai/deepseek-harness safe?
- Python shell/command execution
- Python dynamic code execution
- Node.js shell/command execution
What to do: Read the findings below before installing: each one opens the exact line of code it was found on.
deepseek-ai/deepseek-harness is an npm package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators, though 2 risky constructs are reported for review. It can: dynamic code execution, filesystem read, filesystem write, install time execution, mcp tools detected, network egress and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 30/100 (medium).
@deepseek-ai/dsh-root 0.2.1-alpha.1
Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of deepseek-ai/deepseek-harness's authors. Report a false positive.
Behavioral traits
How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.
Findings (13)
The code turns strings into live code at runtime (eval / new Function / exec).
value = globalThis.eval(command.expression) as unknown
const fn: unknown = globalThis.eval(`(${command.functionDeclaration}\n)`)return new Function(...WRAPPER_PARAMS, code) as (...args: unknown[]) => void
const factory = new Function(...parameters, `return (async () => {\n${clientCode}\n})()`)new Function(wrapped)
Why it matters: If those strings aren't fixed and trusted, they become a way to run arbitrary code.
Fix: Avoid evaluating dynamically constructed code; if unavoidable, ensure the input is a trusted constant and never derived from external data.
The code turns strings into live code at runtime (eval / new Function / exec).
code = compile(wrapped, "<model>", "exec", dont_inherit=True)
exec(code, ns) # noqa: S102 -- defines __dsh_main__; executing model code is the point
Why it matters: If those strings aren't fixed and trusted, they become a way to run arbitrary code.
Fix: Avoid evaluating dynamically constructed code; if unavoidable, ensure the input is a trusted constant and never derived from external data.
package.json runs scripts automatically when the package is installed.
"postinstall": "node scripts/install-lefthook.mjs"
"postinstall": "node scripts/ensure-spawn-helper.mjs"
Why it matters: Install scripts are a favorite supply-chain foothold — they execute on every machine that installs the package.
Fix: Inspect the hook command. Install-time scripts are a common supply chain execution vector; ensure they do nothing beyond a documented build step.
A command uses a known defense-evasion idiom: PowerShell execution-policy bypass / encoded command / hidden window, macOS code-signing bypass, or launching a payload from a world-writable temp directory. These are hallmarks of droppers and rarely appear in legitimate code. (13 occurrence(s) shown as evidence).
execFileSync('/usr/bin/codesign', ['--force', '--deep', '--sign', '-', bundle], { stdio: 'pipe' })$process = Start-Process -FilePath $probe -ArgumentList '/S' -WindowStyle Hidden -PassThru
Fix: Verify why the component bypasses execution policy / code signing or runs from a temp directory; these patterns are characteristic of malware staging.
The component can run operating-system commands or spawn processes.
import { execFile } from 'node:child_process'await exec('git', ['check-ref-format', baseRef])const { stdout: shallow } = await exec('git', ['rev-parse', '--is-shallow-repository'])await exec('git', [const { stdout: baseSha } = await exec('git', ['rev-parse', 'FETCH_HEAD'])const { stdout } = await exec('python3', [import { execFileSync } from 'node:child_process'import { execFileSync } from 'node:child_process'import { execFile } from 'node:child_process'import { spawn, execFileSync } from 'node:child_process'const child = spawn(command, args, { cwd, env: environment, stdio: 'inherit' })import { execFileSync } from 'node:child_process'import { execFile } from 'node:child_process'import { spawn } from 'node:child_process'const child = spawn(process.execPath, [pnpmEntry, ...args], { cwd: REPOSITORY_ROOT, stdio: 'inherit' })import { execFileSync } from 'node:child_process'import { execFile } from 'node:child_process'import { execFile } from 'node:child_process'const { stdout } = await exec('/usr/bin/xcrun', ['notarytool', ...args], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 })import { spawnSync } from 'node:child_process'const result = spawnSync(command, args, { encoding: 'utf8', input, timeout: 120_000 })import { execFileSync } from 'node:child_process'import { execFileSync } from 'node:child_process'import { execFile } from 'node:child_process'import { spawn } from 'node:child_process'Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.
Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; prefer execFile with an argument array.
The component can run operating-system commands or spawn processes.
completed = subprocess.run(command, check=True, capture_output=True, text=True)
subprocess.run(command, check=True)
return subprocess.run(
['git', '-C', repo, '--no-replace-objects', *args], check=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=120,
env={**os.environ, 'GIT_TERMINAL_PROMPT': '0'},
).stdoutraise SystemExit(subprocess.run(argv, env=os.environ).returncode)
self._proc = subprocess.Popen(
args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
encoding="utf-8",
cwd=None if self.co …subprocess.run(command, cwd=ROOT, env=None if environment is None else {**os.environ, **environment}, check=True)result = subprocess.run(
["otool", "-l", str(executable)],
check=True,
capture_output=True,
text=True,
)checked = subprocess.run([sys.executable, "-I", "-B", sys.argv[3], str(root / file), *arguments],
check=False, capture_output=True, text=True, timeout=30)return subprocess.run(
[node, "--version"], capture_output=True, text=True, check=True,
).stdout.strip()subprocess.run([
str(python), "-I", "-B", str(Path(__file__).parent / "primary-runtime/smoke.py"),
json.dumps(manifest["pythonPackages"]), manifest["python"],
str(resources / "offi …installed = subprocess.run(
[str(dsh), "plugin", "--profile", "sdk", "add", f"file:{plugin}"],
cwd=root,
env=environment,
text=True,
capture_output=True,
check=False, …result = subprocess.run(
[str(executable), "--", sys.executable, "-c", target_script],
cwd=root,
env=environment,
capture_output=True,
text=True, …helper_result = subprocess.run(
[node, str(helper), str(executable), sys.executable, str(root), target_script],
cwd=root,
capture_output=True,
text=True,
timeout=30,
ch …self.process = subprocess.Popen(
argv,
cwd=cwd,
env=environment,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True, …Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.
Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; avoid shell=True.
A server is bound to all network interfaces (0.0.0.0), not just your own machine.
const ALL_INTERFACES_HOST = '0.0.0.0'
if (options.host === '0.0.0.0') {program.error('error: --host 0.0.0.0 is intentionally not supported yet for safety: it would expose remote code execution to the network; use 127.0.0.1 instead')host: '127.0.0.1' | '0.0.0.0'
host: z.union([z.const('127.0.0.1'), z.const('0.0.0.0')]).required(),if (host === '::1' || host === '::' || host === '0.0.0.0') return true
Why it matters: Without authentication, other hosts on the network can reach it.
Fix: Bind to 127.0.0.1 for local-only use, or require authentication and restrict access if remote exposure is intended.
The component reads files from disk.
return JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'))
const metadata = JSON.parse(fs.readFileSync(path.join(root, dir, 'prebuilds.json'), 'utf8'));
return `sha512-${crypto.createHash('sha512').update(fs.readFileSync(tarball)).digest('base64')}`;return JSON.parse(fs.readFileSync(file, 'utf8'));
const data = fs.readFileSync(file);
const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8'));
return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');assert.equal(fs.readFileSync(granted, 'utf8').trim(), 'ok');
const manifest = objectOf(JSON.parse(fs.readFileSync(filename, 'utf8')), 'app-boot package.json')
const bytes = await fs.readFile(path, signal)
const bytes = await fs.readFile(path)
Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.
Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.
The component writes or deletes files on disk.
fs.appendFileSync(
fs.rmSync(binDir, { recursive: true, force: true });fs.writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`);fs.writeFileSync(path.join(staging, 'pnpm-workspace.yaml'), 'packages:\n - packages/*\n');
fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);fs.rmSync(destination, { recursive: true, force: true });fs.writeFileSync(path.join(destination, 'publish-order.txt'), `${publishOrder.join('\n')}\n`);if (staging !== undefined) fs.rmSync(staging, { recursive: true, force: true });fs.writeFileSync(
fs.writeFileSync(driver, `
fs.rmSync(lockRoot, { recursive: true, force: true });fs.rmSync(tempRoot, { recursive: true, force: true });await internals.fs.rm(path)
await internals.fs.rm(path)
Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.
Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.
The component reads files from disk.
payload = json.loads(path.read_text())
declared = json.loads(adapter.read_text(encoding="utf-8")).get("optionalDependencies", {})declared = json.loads(adapter.read_text(encoding="utf-8")).get("optionalDependencies", {})manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
payload = json.loads(path.read_text())
payload = json.loads(package_json.read_text())
pyproject.read_text(),
pyproject.read_text(),
pyproject.read_text(),
manifest = json.loads((resources / "primary-runtime/runtime.json").read_text())
declared = json.loads(adapter.read_text(encoding="utf-8")).get("optionalDependencies", {})json.loads(manifest.read_text())["engine"]["kind"]
result = json.loads(result_path.read_text())
pdf = output.read_bytes()
if marker.read_bytes() != LIVE_API_SENTINEL.encode("utf-8"):if receipt.read_bytes() != challenge:
if not marker.is_file() or marker.read_bytes() != challenge:
assert task.read_text(encoding="utf-8") == "Call snapshot_ping once.\n"
assert discovery_log.read_text().splitlines() == [
manifest = json.loads((dsh_home / "profiles" / "sdk" / "package.json").read_text())
source.read_text(encoding="utf-8"),
content = path.read_text(encoding="utf-8")
content = logs[0].read_text()
if not logs[0].read_bytes().startswith(bytes.fromhex("28b52ffd")):content = path.read_text(encoding="utf-8")
Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.
Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.
The component writes or deletes files on disk.
path.write_text("\n".join(lines) + "\n", encoding="utf-8")args.out.write_text(output, encoding="utf-8")
shutil.copytree(
source,
destination,
ignore=ignore,
)pyproject.write_text(text)
shutil.copy2(ROOT / "LICENSE", destination / "LICENSE")
shutil.copy2(ROOT / "THIRD_PARTY_NOTICES.md", destination / "THIRD_PARTY_NOTICES.md")
pyproject.write_text(text)
pyproject.write_text(text)
shutil.copy2(source_directory / filename, runtime_dir / filename)
shutil.copytree(source_directory / office, runtime_dir / office)
shutil.copytree(source_directory / resources, runtime_dir / resources)
path.write_text(json.dumps([
{
"id": "session-persistence-jsonl",
"config": {"root": str(sessions), "compression": "none"},
},
{"id": "session-telemetry-otel", "disabled": True},
*patc …skill.write_text("---\nname: office-docx\ndescription: CUSTOM_OFFICE_DOCX\n---\nUse the bundled Python for custom document work.\n")patch.write_text(json.dumps([{"id": "skill-office", "disabled": True}] if mode == "disabled" else []))shutil.copytree(source, destination)
shutil.copy2(source, destination)
shutil.copy2(Path(__file__).resolve().parent / "fixtures/python-sdk-office.mjs", plugin)
patch.write_text(json.dumps([{"insert": [{
"id": "python-sdk-office-smoke",
"inject": ["skills"],
"name": plugin.as_uri(),
"config": {"input": str(document), "output": str(output), "result": s …marker.write_bytes(challenge)
patch.write_text(json.dumps([
{"id": "llm-deepseek", "config": {"models": [
{"id": "smoke-model", "systemPromptUpdate": "in-history"},
]}},
{"insert": [{ …task.write_text("Call snapshot_ping once.\n", encoding="utf-8")(root / "needle.txt").write_text(f"{FS_SEARCH_MARKER}\n")server_script.write_text(MCP_SERVER_SCRIPT)
(plugin / "package.json").write_text(json.dumps({
"name": "dsh-python-blackbox-plugin",
"version": "1.0.0",
"private": True,
"type": "module",
"exports": "./index.js", …(plugin / "index.js").write_text(
"import { Context } from '@deepseek-ai/cordis'\n"
"export const name = 'python-sdk-blackbox-plugin'\n"
"export const inject = ['systemPrompt']\n"
"export func …Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.
Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.
The component makes outbound network requests.
const response = await fetch(`${process.env.GITHUB_API_URL ?? 'https://api.github.com'}${path}`, {import * as http from 'node:http'
import * as https from 'node:https'
const response = await fetch(url, { redirect: 'error', cache: 'no-store', signal: AbortSignal.timeout(900_000) })const login = await fetch(ready.url, { redirect: 'manual' })const response = await fetch(new URL('/', ready.url), { headers: { cookie } })const pluginResponse = await fetch(new URL('/desktop-smoke', ready.url), { headers: { cookie } })const converted = await fetch(new URL(`/desktop-smoke-office/${extension}`, ready.url), {const cliResponse = await fetch(new URL('/desktop-smoke-office-cli', ready.url), {welcomeBackend = await connectDesktopWelcome(ready.url, (input, init) => net.fetch(input, init), async () => (await session.defaultSession.cookies.get({ url: ready.url })).map(cookie => `${cookie.name}=${cookie.value}`).join('; '))return this.browserSession.fetch(url.href, { ...init, credentials: 'include', redirect: 'error', cache: 'no-store' })const response = await fetch(url, { redirect: 'manual' })const response = await fetch(target, init)
import { validateHeaderName, validateHeaderValue } from 'node:http'import type { IncomingMessage } from 'node:http'const send: RpcFetch = doFetch ?? ((input, init) => globalThis.fetch(input, init))
import type { IncomingMessage } from 'node:http'const response = await apiHandler.fetch(request)
import type { IncomingMessage, ServerResponse } from 'node:http'get fetch(): HostConnectionFetch {if (route?.methods.has(request.method) === true) return route.fetch(request)
return interceptor.fetchHandler.fetch(request)
async fetch(request: Request): Promise<Response> {fetch(request: Request): Promise<Response>
doFetch: UploadWorkerFetch = (input, init) => fetch(input, init),
Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.
Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.
An MCP tool surface (manifest or tool definitions) was found.
Why it matters: Just context — review which tools it offers and their permissions.
Fix: Review the declared MCP tools and their permissions.
How attackers abuse these capabilities
Interactive labs on the attack class behind the rules above. They show the technique, not anything found in deepseek-ai/deepseek-harness.
Check your own component
Run the same evidence-backed scan on any MCP server, agent skill, or package.
Scan your own componentHow we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →