[Bug / Sandbox]: Inconsistent mode escalation vs path whitelist, silent permission drift, and write side-effects in --dump-config #1807
hoangngochuong24947-gif
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
[Bug / Sandbox]: Inconsistent Mode Escalation vs Path Whitelist, Silent Permission Drift, and Unintended Write Side-Effects in
--dump-configDescription / 简述
While developing and wiring bundle plugins (e.g.,
@luliuyuan/dsh-anydoc) in DeepSeek Harness, we observed three critical issues regarding the sandbox permission subsystem and configuration tooling:在为 DeepSeek Harness 开发并接入 bundle 插件时,我们在沙箱权限子系统与配置诊断工具中观察到三个关键异常:
EPERM.沙箱模式升级逻辑自相矛盾:系统提示“当前已处于该模式”,但后续对非工作区路径的写入仍被底层拒绝(
Operation not permitted)。~/.dsh/profiles/web/) transitioned from rejected to allowed mid-session without visible approval dialogs or event logs.运行时权限静默漂移:原本被拒绝的目录在会话中途突然变得可写,缺少显式审批流或变更事件。
--dump-configWrite Side-Effect Crash:--dump-configcrashes with unhandledEPERMin read-only profiles due to eagerwriteFileSyncinprepareProfile.--dump-config意外写盘崩溃:诊断命令在只读配置下因尝试写回cordis.yml而直接崩溃。Environment / 环境信息
0.1.0-rc.5/0.1.0-rc.6v24.x/v22.xweb/ standard presetDetailed Observations & Reproduction / 详细复现与现象
1. Escalation Self-Contradiction / 模式升级自相矛盾
Observed behavior / 现象:
When a tool / subagent attempts to escalate permissions to
workspace-writeordanger-full-accessto write configuration into~/.dsh/profiles/web/or adjacent project roots:or
However, executing write operations (e.g.
touch ~/.dsh/profiles/web/package.jsonorfs.writeFile) immediately afterwards still fails with:Error: EPERM: operation not permittedRoot Cause Analysis / 根因推测:
The lattice permission comparator checks if
requestedLevel <= currentLeveland rejects the request as redundant. However, the underlying FS proxy / path whitelist (AllowedPathsSet) is not expanded or synchronized with the real physical paths required, creating a deadlock where the agent cannot request escalation because it's "already escalated", yet cannot write because the path is not whitelisted.2. Silent Permission Drift / 会话中途权限静默漂移
Observed behavior / 现象:
During an ongoing session:
~/.dsh/profiles/web/and custom plugin root are blocked withEPERM.Recommendation / 建议:
Permission states and path whitelists should follow strict, deterministic Cordis lifecycle state machines, emitting structured events (e.g.
sandbox/escalation-granted) to ensure auditability and prevent non-deterministic race conditions.3.
--dump-configUnhandled Crash in Read-Only Environments / 只读环境下--dump-config崩溃Observed behavior / 现象:
When inspecting configuration via
dsh --profile web --dump-config,prepareProfileinternally callswriteFileSync(join(profileDir, 'cordis.yml')). If the profile folder is read-only or running under a sandboxed read-only permission level,--dump-configcrashes:Recommendation / 建议:
--dump-configand diagnostic commands should operate purely in-memory (dry-run mode) without writing temporary synthesized files to disk.Suggested Fixes / 修复建议
prepareProfilewhen invoked via--dump-config.All reactions