Repository navigation
Guard plugin-add against git transport-helper URLs (match theme-install) - #8067
Conversation
omarchy-plugin-add cloned a user-supplied git URL without the transport-helper guard that omarchy-theme-install already applies (added in omacom#7884, which did not touch plugin-add). Port that guard (reject ext::/fd:: and leading-dash forms, keep https/ssh/scp-style incl. IPv6) and add a regression test. Stock systems are unaffected (git default protocol.ext.allow=never); this removes the silent dependency on that default and aligns the two install paths.
There was a problem hiding this comment.
Pull request overview
Adds defense-in-depth URL validation to plugin installation, matching theme installation behavior.
Changes:
- Rejects Git transport-helper and option-shaped URLs.
- Adds regression tests using a stubbed Git executable.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
bin/omarchy-plugin-add |
Adds pre-clone URL validation. |
test/shell.d/plugin-add-test.sh |
Tests rejected and accepted URL forms. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for bad in "-oProxyCommand=x" "--upload-pack=x"; do | ||
| rm -f "$clone_marker" | ||
| output=$(add_url "$bad") && | ||
| fail "plugin add rejects an option-shaped URL: $bad" "$output" |
The prior leading-dash cases only exercised the argv option parser, not the guard (removing the guard's -* arm left them green). Drive a dash value through the interactive gum prompt under a pty so the post-input guard is actually covered; skip cleanly where util-linux script is unavailable.
|
Good catch. The leading-dash cases were only exercising the argv option parser ( |
Backport of the plugin-add URL guard (PR #8067 by @bastidotnet, merged to quattro as 30471bf) onto the v4-0-1 release branch. omarchy-plugin-add cloned a user-supplied git URL without the transport-helper guard omarchy-theme-install already applies. That guard arrived with #7884, which is on this branch, but it never touched plugin-add -- so the sibling command still leaned entirely on git's own protocol.ext.allow=never to keep a URL like ext::sh -c <cmd> from running a command at clone time. Stock systems are unaffected: Omarchy sets no protocol.* override, so the git default holds and there is no live exploit here. This is defense in depth -- it closes the gap #7884 left in the sibling path and drops a silent dependency on a default the project does not control. Reject ext::/fd:: and leading-dash forms; https, ssh, scp-style and token-auth URLs still clone, including an scp-style IPv6 host, which carries :: of its own. Clean cherry-pick: both files are byte-identical to quattro, so merging v4-0-1 into quattro resolves without a conflict. The guard reads the same as the one already in bin/omarchy-theme-install on this branch. test/shell passes: 186 files, with the plugin-add suite's new cases all running here -- including the pty-driven prompt case, which is the only path that reaches the guard's leading-dash arm. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_018DEMYa9UWtroz93DhMTtcV
…lone from (backport of #8174) Backport of the shared URL check (PR #8174, merged to quattro as 68ab12f) onto the v4-0-1 release branch, on top of the #8067 backport it follows. omarchy-theme-install and omarchy-plugin-add both clone a URL a stranger can choose, and each carried its own copy of the rule that refuses a git option or a transport helper before cloning. The rule now lives in omarchy-git-url-check and both callers ask it: two copies of a security check drift, and the second copy arrived four months after the first only because someone went looking for it. That rule was also enforcing half of what it described. <helper>::<address> is one of two shapes git resolves a remote helper from -- it also runs git-remote-<scheme> for <scheme>://<address> whenever the scheme is not one it connects itself, so ext::sh -c id and ext://sh -c id reach the same helper while only the first was refused. Nothing exploitable follows on a stock system: protocol.ext.allow defaults to never, and the :// spelling hands git-remote-ext a command name it cannot exec. But a third-party helper installed on PATH is reachable through the scheme form alone, and a guard is worth more when it enforces the rule it states. The :// shape cannot be refused the way :: is, because it is also how every legitimate URL arrives, so the scheme is checked against the transports git still connects itself: ssh git git+ssh ssh+git http https ftp ftps file. git+ssh and ssh+git are on that list because they are spelled like a helper and read as plain ssh; leaving them off would refuse a URL that clones today. ext and fd are off it deliberately. A single colon is always scp-style ssh and a bare path is always a path, so neither needs constraining. The check fails closed: the callers read a non-zero status as a refusal, so a missing omarchy-git-url-check refuses the URL rather than waving it through. Clean cherry-pick on top of the #8067 backport: every file is byte-identical to quattro, so merging v4-0-1 into quattro resolves without a conflict. test/shell passes: 189 files, including the one this adds. test/cli passes, so the new command's metadata is well-formed. Exercised the check here: https, scp-style, ssh, git+ssh and scp-style IPv6 all pass, while ext:: ext:// fd:: fd:// and a leading-dash form are refused, as is an uppercase EXT:// spelling. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_018DEMYa9UWtroz93DhMTtcV
…ll) (omacom#8067) * Guard plugin-add against git transport-helper URLs omarchy-plugin-add cloned a user-supplied git URL without the transport-helper guard that omarchy-theme-install already applies (added in omacom#7884, which did not touch plugin-add). Port that guard (reject ext::/fd:: and leading-dash forms, keep https/ssh/scp-style incl. IPv6) and add a regression test. Stock systems are unaffected (git default protocol.ext.allow=never); this removes the silent dependency on that default and aligns the two install paths. * Test the plugin-add guard's leading-dash arm via the gum input path The prior leading-dash cases only exercised the argv option parser, not the guard (removing the guard's -* arm left them green). Drive a dash value through the interactive gum prompt under a pty so the post-input guard is actually covered; skip cleanly where util-linux script is unavailable.
What
omarchy-plugin-addclones a user-supplied git URL without validating the URL'stransport, while
omarchy-theme-installalready guards against exactly this. This portsthat guard to
plugin-addand adds a regression test.Why
#7884 ("Stop an installed theme from running code") added a transport-helper guard to
omarchy-theme-install— it rejectsext::,fd::and leading-dash option forms beforecloning — but did not touch
omarchy-plugin-add. Soplugin-addstill relies entirely ongit's default
protocol.ext.allow = neverto stop a URL likeext::sh -c <cmd>fromrunning a command at clone time.
On a stock system that default holds and there is no exploit — Omarchy sets no
protocol.*override. This is therefore defense-in-depth, not a fix for a live RCE: it closes the
gap #7884 left in the sibling command, and removes a silent dependency on a git default the
project doesn't control. (#7622, which would accept plugin URLs from web pages, makes the
guard more relevant still.)
Change
$urlthrough the same guard used bytheme-install, after bothinput sources (argv and
gum input) and beforegit clone, reusing the existingfailhelper.
ext::/fd::transport-helper forms and-*/--*option forms.https://…,git@host:org/repo.git,ssh://…, token-auth URLs, andscp-style IPv6 (
git@[2001:db8::1]:org/repo.git).Test
Adds a regression test to
test/shell.d/plugin-add-test.shasserting both the rejectionsand that the legitimate URL forms above still pass the guard.
gitis stubbed, so nonetwork. Existing plugin-add suite passes;
shellcheck -xclean on the changed script.