feat: enhance safety and crash resilience in file operations; add fsync to critical writes and checks for path traversal

This commit is contained in:
asepharyana
2026-07-12 11:49:33 +07:00
parent 8767beef39
commit 87d0aac596
9 changed files with 79 additions and 26 deletions
+3
View File
@@ -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"))?