Repository navigation
Require a per-session token for notification click-exec - #12912
chessing234 wants to merge 1 commit into
Conversation
Sandboxed same-uid bus clients can forge omarchy-exec-argv; mint a token under XDG_RUNTIME_DIR that only host helpers can read, and ignore click commands whose omarchy-exec-token does not match. Closes omacom#8433.
|
Two edge cases remain: notification readiness can precede token readiness, and pre-upgrade click commands remain trusted after restoration. Verified: At Include token minting in notification readiness
The real sender and notification logic produced these results with synthetic runtime state and a stubbed notification transport:
Impact: Startup/restart callers can lose a notification or receive a toast without its advertised action despite passing the existing readiness check. The pending-migrations caller falls back to terminal/journal text when sending fails. These tests model the ordering; live scheduling and its frequency were not measured. Suggested change: Make the readiness contract used by Pre-upgrade persisted click commands remain trustedThe old service accepted unauthenticated argv hints and saved them as A synthetic old critical-popup record retained a runnable argv through the current Impact: A forged toast planted while the old shell was running can remain actionable after the hardening update. This requires a pre-existing unvalidated entry and a later click, not a fresh-notification bypass of the new token check. It does not require the confined sender to write the state directory directly. Suggested change: Strip click argv from pre-token popup/history records, or mark newly token-validated records and accept restored actions only from those. This deliberately sacrifices click actions on legitimate old entries once, while preserving their text and subsequent validated actions across restarts. Review informationTest scope: Pinned sender and JavaScript logic, synthetic runtime/token and legacy-popup data, stubbed notification transport, and source-path inspection. No live Quickshell click, Flatpak confinement test or measured startup race. The token boundary assumes the sender cannot obtain the token or modify trusted persisted state. Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra Medium performed initial inspection and synthesis, with independent Opus 5.5 High and GPT 6 Sol Xhigh technical reviews. Claims were checked against targeted evidence and source paths. |
|
Thanks for tightening up
Suggested fix: keep one token for the whole login session, and have the sender wait briefly for it. (a) Only mint the token when the file is missing or empty (in set -euo pipefail
runtime="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
dir="$runtime/omarchy"; f="$dir/notification-exec-token"
mkdir -p -m 700 -- "$dir"
umask 077
if [[ ! -s $f ]]; then
openssl rand -hex 32 >"$f.$$" && mv -f -- "$f.$$" "$f"
fi
cat -- "$f"(b) In for _ in {1..30}; do [[ -s $exec_token_file ]] && break; sleep 0.1; done(c) A test where the token file is missing when the server comes up and appears shortly after would guard this. Because |
|
folding into #12111 — session exec-token gate is already on the notification fold. |
Summary
$XDG_RUNTIME_DIR/omarchy/notification-exec-tokenwhen the notifications service starts, and honoromarchy-exec-argvonly when the matchingomarchy-exec-tokenhint is present.omarchy-notification-send --execfails closed if the token file is unreadable; forged click-exec from sandboxed session-bus clients (Flatpak etc.) no longer works.execArgvstill persists across restarts; the token is never written to popup/history snapshots.Closes #8433
Test plan
bash test/shell.d/notifications-test.sh(token match/mismatch, no token in persistence, service mint path)bash test/shell.d/notification-send-test.sh(token attached with--exec, fail closed without token file)--execstill runs the command when the shell is upomarchy-exec-argvhint shows a toast but has no click command