feat: enhance safety and crash resilience in file operations; add fsync to critical writes and checks for path traversal
This commit is contained in:
@@ -47,6 +47,9 @@ impl Tool for GitWorktree {
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| anyhow!("missing required argument: name"))?
|
||||
.to_string();
|
||||
if name.contains('/') || name.contains('\\') || name.contains("..") {
|
||||
anyhow::bail!("worktree name must not contain path separators or '..'");
|
||||
}
|
||||
let base_ref = args.get("base_ref")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| anyhow!("missing required argument: base_ref"))?
|
||||
|
||||
Reference in New Issue
Block a user