Repository navigation
Harden tui launcher install and removal - #9150
rihadroshan wants to merge 6 commits into
Conversation
Port webapp-install's name and desktop-value guards to tui-install: a name can no longer nest the launcher (slash), climb out of the applications directory (../), or inject extra desktop-entry keys via a newline in Name/Comment/Exec/Icon. tui-remove now deletes the indexed launcher like webapp-remove, so entries left nested by older installs stay removable. Test: shell (tui-install-hardening-test.sh)
Harden tui launcher install and removal
|
One issue: Explicit removal can delete the wrong launcher in omarchy-tui-remove, lines 54–55. The new lookup selects the first matching basename in the recursive scan. If both applications/Docker.desktop and applications/legacy/Docker.desktop exist, omarchy-tui-remove Docker can delete the legacy entry while leaving the requested top-level entry installed. This also affects removal through the app launcher. |
|
should we think about using hqtui for this? |
The removal index returned whichever launcher find met first, so with applications/Docker.desktop and a legacy applications/x/Docker.desktop, removing Docker could delete the nested entry and leave the one the launcher's remove action named. The top-level path now wins when it is indexed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and run on a disposable Omarchy VM, at d0bcaf3. The bugs are real on One fix pushed to your branch (d0bcaf3). @ErikMelton's finding is correct. Tests on the VM: The change is proportionate. It copies the guards Second opinion: none. The configured reviewer, Codex Medium, answers when pinged, but today's review budget was used up before this item, so only Claude Opus 5.5 reviewed it. Because of that, it is labelled |
[Low impact] The change is limited to local TUI launcher removal. The lookup change looks sound, but the earlier newline-removal and nested-icon bugs still block merging. Findings
SummaryThe PR makes
Reviews (2) · Last reviewed commit: "Merge quattro into TUI launcher hardenin..." · Reviewed by Greptile |
| # is stuck in the launcher; a leading ../ leaves the applications directory | ||
| # altogether. Refuse rather than silently renaming what the user typed -- most | ||
| # often it is a URL entered in the name field. | ||
| if [[ $1 == */* ]]; then |
There was a problem hiding this comment.
Newline names cannot be removed
The new guard accepts names containing newlines, and the new test installs one. During interactive removal, omarchy-tui-remove prints each indexed name on a separate line before sorting, so that name becomes multiple menu choices. Selecting a fragment cannot remove the launcher and may instead remove a different launcher named after that fragment. Reject newlines in names or preserve names intact through selection.
There was a problem hiding this comment.
At 3b7b242, the installer comes unchanged from quattro: #19965 already merged its name guard and desktop-value escaping. This PR now changes only the remover's top-level namesake preference and regression coverage. Newline names splitting in the picker is inherited from quattro, including its webapp picker, and is unchanged by this fix.
Checked by Codex High, Opus 5.5 High and muse-wonder via pi (thinking high); the reviewers agreed, and independence is not guaranteed.
There was a problem hiding this comment.
Agreed. At 3b7b242, omarchy-tui-install’s name guard and desktop escaping are already present in the base branch, and this PR does not change the picker’s line-based handling. The newline-name picker issue is pre-existing (and also affects the webapp picker), so I’m withdrawing the finding as out of scope for this change. The underlying behavior may still merit a separate fix.
| desktop_file=$(path_for_tui "$APP_NAME") | ||
| rm -f "${desktop_file:-$DESKTOP_DIR/$APP_NAME.desktop}" | ||
| rm -f "$ICON_DIR/$icon_name.png" "$ICON_DIR/$APP_NAME.png" "$OLD_ICON_DIR/$APP_NAME.png" |
There was a problem hiding this comment.
Nested launcher icons are mishandled
When this lookup removes a legacy launcher such as foo/Bar.desktop, icon cleanup uses only Bar. The installer named downloaded or copied icons from the full app name foo/Bar, producing foo-bar.png. Removal therefore leaves that icon behind and can delete an unrelated bar.png icon. Derive icon cleanup from the matched legacy entry.
There was a problem hiding this comment.
At 3b7b242, the nested-entry lookup and icon cleanup come from quattro through #19965. The only production change is to prefer an indexed top-level TUI over a nested namesake. The legacy icon-name mismatch remains an inherited issue in both versions; this change preserves the existing cleanup.
Checked by Codex High, Opus 5.5 High and muse-wonder via pi (thinking high); the reviewers agreed, and independence is not guaranteed.
There was a problem hiding this comment.
Agreed. The icon-name mismatch is inherited behavior, not introduced by this PR; the diff’s production change only makes an indexed top-level launcher take precedence over a nested namesake. I’ll withdraw this finding as out of scope for the change.
| inject_name=$(printf 'Inject\nExec=evil') | ||
| run_install "$inject_name" "lazydocker" tile hey >/dev/null | ||
| inject_file="$apps_dir/$inject_name.desktop" | ||
| [[ -f $inject_file ]] || | ||
| fail "tui install writes a desktop entry for a name containing a newline" | ||
| (( $(grep -c '^Exec=' "$inject_file") == 1 )) || | ||
| fail "a newline in the name cannot inject a second Exec" "$(cat "$inject_file")" | ||
| grep -Fqx 'Name=Inject\nExec=evil' "$inject_file" || | ||
| fail "a newline in the name is escaped in the Name field" "$(cat "$inject_file")" | ||
| pass "tui install escapes newlines instead of writing a second Exec" |
There was a problem hiding this comment.
Exec and Icon escaping untested
This test injects a newline only through the app name, although the change also escapes the Exec and Icon values. A regression in either of those write paths would pass the hardening test. Add newline-bearing command and icon cases to cover them.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
At 3b7b242, desktop-value escaping is unchanged from quattro after #19965. The standalone hardening test has been consolidated into the existing webapp-name-test.sh; the production diff contains no Exec or Icon writer change. The added regression forces both find orders and checks which launcher is deleted and retained, including the nested fallback.
Checked by Codex High, Opus 5.5 High and muse-wonder via pi (thinking high); the reviewers agreed, and independence is not guaranteed.
quattro moved the interactive prompts to omarchy-i18n; keep those and refuse a slashed name straight after the name prompt, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-reviewed at 5cbd41d, run on a disposable Omarchy VM. Merged Tests on the VM, against current Greptile's three findings, checked against the source:
Second opinion: Codex Medium reviewed the merge and the full diff. It found nothing blocking and judged the change proportionate. On Greptile's findings it reached the same conclusions as above (independence is not guaranteed). It also pointed out that the two creation orders in the top-level-versus-nested test don't guarantee two different Nothing is left for you to do. It is waiting on the maintainer. |
Keep the current installer guards and locale test fixes from quattro while preserving top-level TUI launcher precedence. The hardening and nested lookup now ship through omacom#19965; consolidate the remaining regression coverage into the existing webapp-name tests and force both find traversal orders. Co-Authored-By: Codex High <noreply@openai.com>
|
Updated to On a disposable Omarchy ISO worker, the new namesake test fails on current Codex High reviewed the change; Opus 5.5 High and muse-wonder via pi, thinking high also reviewed this head and found no blocking defects. They agreed on correctness and proportionality; independence is not guaranteed. Greptile's inherited newline-picker and legacy-icon findings have replies in their own threads, and Greptile has withdrawn those two findings there, although its current summary still scores 3/5. The branch is verified. GitHub's |
Port webapp-install's name and desktop-value guards to tui-install.
Problem. omarchy-tui-install wrote its .desktop with raw values. A / in the app name became directory levels (unreachable by omarchy-tui-remove, and ../ escaped ~/.local/share/applications), and a newline could inject a second Exec= key. Its sibling omarchy-webapp-install already solves both with require_plain_name + desktop_string_escape.
Fix.
Verified: new test 7/7 pass; webapp-name, webapp-install-escaping, webapp-install, launcher-remove, desktop-entry-launch, refresh-config all green.