安全漏洞: 读取/编辑工作区围栏 TOCTOU — 在 canonicalize() 之后交换了符号链接,使工作区文件可以读取主机上的任何文件(CWE-367、CWE-59)
作者: qc9c创建于 2026年9月26日更新于 2026年9月26日
// src-Rust/crates/core/src/lib.rs:2220-2239 fn is_path_within_allowed_roots( path: &str, working_dir: Option<&std::path::Path>, allowed_roots: &[std::path::PathBuf], ) -> bool { let canonical_path = std::fs::canonicalize(path) .unwrap_or_else(|_| std::path::PathBuf::from(path)); // ... build canonicalized roots ... roots.iter().any(|root| canonical_path.starts_with(root)) // line 2238 }
内容来源: Kuberwastaken/claurst