dshbase

插件目录 / Developer / dsh-python-tempfile-shim

dsh-python-tempfile-shim

未验证 AngelosZou

✓ 持续维护 基于 1 个官方 DSH 包

查看 GitHub ↗ ← 返回插件目录

1Stars
0Forks
0未关闭 issue
语言
2026-08-16最近推送
跨平台平台

功能简介

Developer 类别的 DeepSeek Harness 插件。

我们的评价
未验证 — 尚未实测

Developer 类别的 DeepSeek Harness 插件。 尚未验证——请自行安装测试。

「未验证」表示我们的自动化 CI 尚未安装过该插件。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

你是插件作者? 想拿到「已验证」标签——提交你自己的验证证据(截图、日志或短视频),我们审核通过后即改为「已验证」。

提交验证证据 ↗

README

dsh-python-tempfile-shim

简体中文

Temporary plugin that works around one Windows sandbox incompatibility until
DeepSeek Harness ships an upstream fix. It is not published to npm; install it
from a local clone. Read SECURITY.md before installing.

The plugin lets Python (including pytest) use temporary directories inside the
DSH Windows sandbox. Background: CPython on Windows builds a directory DACL
from os.mkdir's mode argument; 0o700 produces an owner-only directory.
tempfile.mkdtemp and pytest's basetemp chain both use 0o700. The DSH
Windows sandbox runs commands under a WRITE_RESTRICTED token whose
restricting-SID list excludes the user's own SID, so the confined process
cannot read or write the directories it just created. pytest tmp_path/
tmpdir tests fail with [Errno 13] / WinError 5 and the
[sandbox: file access denied under workspace-write mode] marker.

How it works — fully automatic, no extra tools

The plugin patches the mounted shell executor's resolve() — the single
chokepoint every shell consumer passes through (the pwsh tool, background
jobs, in-process plugin bridges) — so that every confined command
(workspace-write / read-only) inherits PYTHONPATH=<plugin assets dir>.
The bundled assets/sitecustomize.py then makes os.mkdir ignore the mode
argument, so new directories inherit the parent ACL (which carries the
sandbox's workspace/temp write ACEs) instead of CPython's owner-only DACL.

Because the injection happens at the executor level:

  • No extra tools to rememberpython, pytest, pip, tox, nox,
    venvs, and any child Python process all get the fix automatically.
  • No extra model context — the agent just runs Python normally through
    pwsh. A compact always-on system-prompt section tells it the fix is
    automatic so it never reaches for workarounds.
  • Zero escalation — the sandbox boundary is untouched: token, ACEs,
    policy, and escalation surface are all left alone.

PYTHONPATH is inert for non-Python commands, so adding it to every confined
command is safe; a command that sets $env:PYTHONPATH itself still overrides
it. The shim is deliberately not injected for unsandboxed compositions or
danger-full-access runs (the bug does not exist there, and 0o700 is
CPython's privacy hardening that unconfined runs should keep).

A python-tempfile-shim skill is also registered for humans and for the rare
case where a failure still appears (diagnose + report).

Scope

  • All 0o700 directory creation routes through os.mkdir: tempfile.mkdtemp,
    tempfile.TemporaryDirectory, os.makedirs(mode=0o700),
    pathlib.Path.mkdir(mode=0o700), pytest, tox/nox (the shim propagates to
    subprocesses via PYTHONPATH).
  • Windows only; on other platforms apply() registers nothing.
  • File creation (os.open/mkstemp modes) is not affected and needs no patch.

Install

git clone https://github.com/AngelosZou/dsh-python-tempfile-shim.git
dsh plugin --profile web add link:<local repository path>

Restart DSH afterwards.

Uninstall: remove the plugin from the DSH settings page, then restart DSH.

Verification

  • Environment: Windows, DSH workspace-write sandbox, Python 3.11.15 / 3.13.14,
    pytest 9.1.1.
    • Without the plugin: tmp_path test fails with PermissionError: [WinError 5].
    • With the plugin: 1 passed; mkdtemp, TemporaryDirectory, mkstemp,
      and basetemp cleanup work — run through the ordinary pwsh tool, no
      special arguments.
  • Subprocess propagation: parent Python process to child Python process
    (inherited PYTHONPATH) works.
  • Smoke test: npm test covers the resolve-patch contract (confined modes
    injected, danger-full-access/unsandboxed left alone, idempotency,
    disposal, no spec mutation) plus prompt-section and skill registration.

Security

See SECURITY.md. Note: do not install
assets/sitecustomize.py into global site-packages or a machine-wide
PYTHONPATH; 0o700 is CPython's privacy hardening and unsandboxed runs should
keep it.

Upstream status

Uninstall this plugin once an upstream fix ships.

License

MIT

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-python-tempfile-shim」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:AngelosZou/dsh-python-tempfile-shim

Headless(CLI)profile:

dsh plugin --profile headless add github:AngelosZou/dsh-python-tempfile-shim

实测报告

尚未 L3 验证——若已跑过,见下方失败备注。

状态:pending · 最近测试 2026-08-26
备注:验证: runtime-fail 浏览全部待验证失败 →
安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7795 个插件 →