Run notification click actions as safe argv (backport of #7926)
Backport of the notification click-command hardening (PR #7926, merged to
quattro as 43bfe9b9) onto the v4-0-1 release branch. Click actions are argv
vectors run without a shell, omarchy-notification-send calls the Notify D-Bus
method directly via busctl instead of notify-send, and --exec takes the command
as rest-of-line words. Excludes docs/notifications.md, which does not exist on
v4-0-1.
This commit is contained in:
1 parent
f2a2973de8
commit
286b8c2b1c
28 files changed
+494
-184
No files matched your search
@@ -62,11 +62,12 @@ 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. Names with spaces have to arrive quoted for the shell to run them.
|
||||
# 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 xdg-open $(printf %q "$downloads/notes with space.pdf")" <<<"$notifications" ||
|
||||
fail "taildrop receive quotes spaced names in the open command" "$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"
|
||||
|
||||
grep -q "unrelated.txt" <<<"$notifications" &&
|
||||
|
||||
Reference in new issue
Block a user