Make --exec take the command as rest-of-line words
Replace --exec-arg with an ergonomic --exec that consumes the rest of the line as the click command. The caller's shell tokenizes the words into discrete arguments before the tool sees them, and the shell runs them as positional parameters (never a re-parsed string), so safety is identical to the argv form while the call sites read naturally: `--exec omarchy toggle something`. Crucially the tool never splits a string itself — a single quoted whole-command argument is rejected and points at the unquoted form, because whitespace- splitting a string hands argument boundaries to whoever controls its content (the injection we are avoiding). --exec must come last; migrate every caller.
This commit is contained in:
@@ -62,11 +62,11 @@ pass "taildrop receive announces other files with a glyph"
|
||||
|
||||
# The shell keeps the click command with the toast, so receiving does not have
|
||||
# to sit blocked on an answer -- and the toast still opens the file after a shell
|
||||
# restart. The path rides as its own --exec-arg, so the shell runs it as literal
|
||||
# data with no quoting for a name with spaces to get wrong.
|
||||
grep -qF -- "--exec-arg xdg-open --exec-arg $downloads/photo.png" <<<"$notifications" ||
|
||||
# restart. The path rides as its own discrete --exec argument, so the shell runs
|
||||
# it as literal data with no quoting for a name with spaces to get wrong.
|
||||
grep -qF -- "--exec xdg-open $downloads/photo.png" <<<"$notifications" ||
|
||||
fail "taildrop receive attaches the open command to the notification" "$notifications"
|
||||
grep -qF -- "--exec-arg xdg-open --exec-arg $downloads/notes with space.pdf" <<<"$notifications" ||
|
||||
grep -qF -- "--exec xdg-open $downloads/notes with space.pdf" <<<"$notifications" ||
|
||||
fail "taildrop receive carries spaced names as a literal open argument" "$notifications"
|
||||
pass "taildrop receive lets a click open the received file"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user