修复: workspace_root 去固定根完整(reload 尊重用户 persistent)

CR-28 审查 🟡 WATCH-1:reload_allowed_dirs 仍无条件 insert workspace_root(pre-existing),
致 commit 声称"用户删白名单后需授权"无法兑现(reload 塞回 persistent)。
修:reload KV 有配时不无条件 insert workspace_root,尊重用户 persistent。
(仅 KV 未配 default_with_root 含 workspace_root,首次免授权行为不变)

CR-28 审查回填( PASS,🟡 WATCH-1 已修闭环)。
This commit is contained in:
2026-06-20 04:14:10 +08:00
parent e4c2e310a5
commit b22e9ae912
2 changed files with 32 additions and 2 deletions

View File

@@ -573,8 +573,9 @@ impl AppState {
}
};
let mut set = HashSet::new();
// workspace_root 始终在白名单(向后兼容);不重复插入
set.insert(workspace_root_path());
// F-260619-03 收尾:KV 有配时尊重用户 persistent(不无条件塞 workspace_root)。
// 用户 KV 配置不含 workspace_root → 工程根也需授权(动态白名单完整语义,
// 兑现 commit 声称"用户删白名单后需授权")。仅 KV 未配时 default_with_root 含 workspace_root。
for d in dirs {
let d = d.trim();
if d.is_empty() {