Skip to content

Refuse a default browser entry that runs the launcher itself - #15610

Open
AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:launch-browser-self-exec-guard
Open

AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:launch-browser-self-exec-guard

Conversation

@AnPod

@AnPod AnPod commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #15581

Problem

A default HTTP/HTTPS handler whose desktop entry's Exec= resolves to omarchy-launch-browser made every browser launch recurse: each generation probed the command's --help (spawning one more launcher) and handed the URL to another generation through systemd-run (spawning yet another), doubling until the process table filled and the session stalled.

omarchy-cmd-default-browser only skips the well-known omarchy-browser.desktop when walking the mimeapps lists, so any other entry that resolves back to the launcher — a renamed copy of omarchy-browser.desktop, a user-written entry, or anything else with Exec=omarchy-launch-browser — still reaches the recursion on quattro.

Fix

bin/omarchy-launch-browser now refuses to run when the resolved browser command is omarchy-launch-browser itself: it prints an error naming the offending entry to stderr and exits non-zero before probing flags or handing anything to systemd-run.

Test

Extended test/shell.d/launch-browser-test.sh with a self-referencing entry (selfref.desktop with Exec=omarchy-launch-browser %U) set as the x-scheme-handler/http default in a private mimeapps.list:

  • Without the fix the new scenario fails: the launcher exited 0, re-invoked itself (stubbed) and handed the URL to the (stubbed) systemd-run.
  • With the fix it passes: the launcher exits non-zero, never re-invokes itself, never calls systemd-run, and the error names the entry.
  • The file's existing scenarios and the related default-browser-lookup, browser-env and browser-link-handoff tests all still pass.

A default HTTP handler whose desktop entry's Exec is
omarchy-launch-browser made every launch recurse: each generation
probed the command's --help and handed the URL to another generation
through systemd-run, doubling until the process table filled
(omacom#15581). omarchy-cmd-default-browser only skips the well-known
omarchy-browser.desktop, so any other entry resolving back to the
launcher still reached the recursion. Exit with an error naming the
entry instead.
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The change is limited to browser link launches with a self-referencing default entry.

The PR appears safe to merge, with a non-blocking fix needed for the test stub.

Findings

  1. P2 Re-entry skips the test stub ▶

Summary

The launcher now rejects a default browser entry whose command is named omarchy-launch-browser, before checking private flags or starting another process.

  • Browser links stop when their default entry points back to the launcher.

Reviews (1) · Last reviewed commit: "Refuse a default browser entry that runs..." · Reviewed by Greptile

Comment on lines +129 to +132
cat >"$mock_bin/omarchy-launch-browser" <<'SH'
#!/bin/bash
printf '%s\n' "$*" >>"$OMARCHY_TEST_BROWSER_RECURSE"
SH

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Re-entry skips the test stub

The new omarchy-launch-browser stub is never made executable. Since $ROOT/bin follows $mock_bin in PATH, an unexpected call skips the stub and runs the real launcher instead. Add chmod +x "$mock_bin/omarchy-launch-browser" so the test can safely record re-entry in recurse_log.

Suggested change
cat >"$mock_bin/omarchy-launch-browser" <<'SH'
#!/bin/bash
printf '%s\n' "$*" >>"$OMARCHY_TEST_BROWSER_RECURSE"
SH
cat >"$mock_bin/omarchy-launch-browser" <<'SH'
#!/bin/bash
printf '%s\n' "$*" >>"$OMARCHY_TEST_BROWSER_RECURSE"
SH
chmod +x "$mock_bin/omarchy-launch-browser"

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this. It has not been verified yet, and nothing has been run: the classification needs a second model to agree, and the second opinion (Codex Medium) did not run today because the reviewer's daily review limit was used up. So the pull request has no class label and nothing has been run on a test machine. It goes round again once a second opinion is available.

I (Claude Opus 5.5, alone) read it against quattro at cce8b1c and found two things worth knowing in the meantime:

  • The case in omarchy-launch-browser: Recursive fork bomb when default browser handler resolves to omarchy-browser.desktop #15581, a handler set to omarchy-browser.desktop, is already handled on quattro. Since Route links from every app through the running default browser #14441, bin/omarchy-cmd-default-browser skips that entry in the mimeapps lists and never prints it from the xdg-settings/xdg-mime fallback. What this guard adds is protection against any other entry whose Exec= is omarchy-launch-browser.
  • test/shell.d/launch-browser-test.sh:132: the omarchy-launch-browser stub written into $mock_bin is never made executable, which Greptile also pointed out. Because of that, a call to the launcher from inside the launcher skips the stub and runs the real $ROOT/bin/omarchy-launch-browser. As written, the recurse_log check can never fail: re-entry is never recorded, and it is the launch_log check that catches a missing guard. It needs chmod +x "$mock_bin/omarchy-launch-browser" after the heredoc.

Next, this waits on the second opinion. Once the class is agreed, the fix will be reproduced on a worker, failing on quattro and passing at this head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-launch-browser: Recursive fork bomb when default browser handler resolves to omarchy-browser.desktop

2 participants