Skip to content

Share the git URL check, and refuse the transports Omarchy does not clone from - #8174

Merged
dhh merged 2 commits into
quattrofrom
guard-git-url-scheme-allowlist
Aug 25, 2026
Merged

dhh merged 2 commits into
quattrofrom
guard-git-url-scheme-allowlist

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

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 one place, 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 — git ships a helper for each, and ext runs whatever command the URL carries. 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.

Follows on from #8067, which added the :: half of this check to omarchy-plugin-add.

🤖 Generated by Opus 5 in Claude Code. Reviewed by Codex XHigh.

dhh and others added 2 commits August 25, 2026 08:54
Both commands clone a URL a stranger can choose, and each carried its own copy of the rule that refuses a git option or a `<helper>::<address>` transport helper before cloning. Two copies of a security check drift: the second one arrived four months after the first, and only because someone went looking for it.

The rule now lives in omarchy-git-url-check and the callers ask it. Its absence refuses the URL rather than waving it through, since the callers read a non-zero status as a refusal and a missing command exits 127.

Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Codex XHigh <[email protected]>
`<helper>::<address>` is only one of the two ways a URL reaches a remote helper. git also resolves 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` arrive at the same helper while only the first was refused.

That shape cannot be refused outright, because it is also how every legitimate URL arrives, so the scheme is checked against the transports git still connects itself. `git+ssh` and `ssh+git` are on that list: they are spelled like a helper and read as plain ssh, and leaving them off would refuse a URL that clones today. `ext` and `fd` are off it deliberately -- git ships a helper for each, and `ext` runs whatever command the URL carries.

Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Codex XHigh <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 25, 2026 06:57

Copilot AI left a comment

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.

Pull request overview

Centralizes Git URL validation and blocks unsupported transport helpers before cloning themes or plugins.

Changes:

  • Adds a shared, fail-closed Git URL checker.
  • Updates theme and plugin installation commands to use it.
  • Expands regression coverage for helper schemes and missing checker behavior.

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 3 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bin/omarchy-git-url-check Implements shared transport validation.
bin/omarchy-theme-install Delegates URL checks to the shared command.
bin/omarchy-plugin-add Delegates URL checks to the shared command.
test/shell.d/git-url-check-test.sh Tests accepted and rejected URL forms.
test/shell.d/theme-install-guards-test.sh Tests unsupported schemes and fail-closed behavior.
test/shell.d/plugin-add-test.sh Tests scheme rejection before cloning.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dhh
dhh merged commit 68ab12f into quattro Aug 25, 2026
4 checks passed
@dhh
dhh deleted the guard-git-url-scheme-allowlist branch August 25, 2026 07:11
omarchybot added a commit that referenced this pull request Aug 25, 2026
…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
@omarchybot omarchybot mentioned this pull request Aug 25, 2026
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
…lone from (omacom#8174)

* Share the git URL check between theme-install and plugin-add

Both commands clone a URL a stranger can choose, and each carried its own copy of the rule that refuses a git option or a `<helper>::<address>` transport helper before cloning. Two copies of a security check drift: the second one arrived four months after the first, and only because someone went looking for it.

The rule now lives in omarchy-git-url-check and the callers ask it. Its absence refuses the URL rather than waving it through, since the callers read a non-zero status as a refusal and a missing command exits 127.

Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Codex XHigh <[email protected]>

* Refuse a git URL naming a transport Omarchy does not clone from

`<helper>::<address>` is only one of the two ways a URL reaches a remote helper. git also resolves 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` arrive at the same helper while only the first was refused.

That shape cannot be refused outright, because it is also how every legitimate URL arrives, so the scheme is checked against the transports git still connects itself. `git+ssh` and `ssh+git` are on that list: they are spelled like a helper and read as plain ssh, and leaving them off would refuse a URL that clones today. `ext` and `fd` are off it deliberately -- git ships a helper for each, and `ext` runs whatever command the URL carries.

Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Codex XHigh <[email protected]>

---------

Co-authored-by: David Heinemeier Hansson <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Codex XHigh <[email protected]>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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.

4 participants