Repository navigation
Description
Describe the bug
apm marketplace add does not recognize a fully-qualified ssh:// URL. The value is misclassified as host/owner/repo-style shorthand, so the leading ssh: segment ends up inside the owner/repo path (with a default host silently assumed) and surfaces as a mangled ssh:/ in the error.
This matters most for servers that accept SSH only on a non-default port: the SCP-like shorthand (git@host:org/repo.git) that apm marketplace add does support cannot express a port, so the broken ssh://host:port/... form is the only apm-native syntax for that case — leaving no working syntax at all, short of external workarounds such as git's insteadOf rewrite (below) or an ssh_config host entry.
To Reproduce
The supplied host is never contacted, so this reproduces even against a nonexistent host — no real Git server needed:
$ apm --version
Agent Package Manager (APM) CLI version 0.27.0 (703dd9e)
$ apm marketplace add "ssh://git@nonexistent-host-test.invalid:2222/org/repo.git"
[*] Registering marketplace 'repo'...
[x] No marketplace.json found in 'ssh:/git@nonexistent-host-test.invalid:2222/org/repo'. Checked: marketplace.json, .github/plugin/marketplace.json, .claude-plugin/marketplace.json
$ echo $?
1The same command without the port fails identically, so this is not port-specific. For contrast, the forms apm marketplace add does recognize proceed to the network stage and fail there on hostname resolution, as expected for a nonexistent host:
$ apm marketplace add "git@nonexistent-host-test.invalid:org/repo.git"
[*] Registering marketplace 'repo'...
[x] Failed to register marketplace: Failed to fetch marketplace 'repo': git ls-remote failed for git@nonexistent-host-test.invalid:org/repo.git: ssh: Could not resolve hostname nonexistent-host-test.invalid ...(https://nonexistent-host-test.invalid/org/repo.git likewise reaches git ls-remote. The .git suffix dropping in the first error is apm's own normalization, not a separate issue.)
Expected behavior
A fully-qualified ssh:// URL (with or without a port) should be recognized as an SSH remote and reach the same git ls-remote stage that the SCP-like and https:// forms reach.
Environment
- OS: macOS
- APM Version: 0.27.0 (703dd9e), via
apm --version - Installed via: Homebrew (
microsoft/apmtap)
Additional context
Root cause, from our own reading of the v0.27.0 source (not maintainer-confirmed): _parse_marketplace_source() (src/apm_cli/commands/marketplace/__init__.py, lines 247-387) handles local paths, file://, SCP-like SSH, https://, and shorthand — there is no ssh:// branch. An ssh:// value falls into the shorthand split("/") path, where ssh: fails the FQDN host check (line 354) and becomes the leading owner-path segment, with default_host() (github.com) silently assumed (line 383) — consistent with the observed error. Three signs this is a gap rather than intended scope:
- Dependency resolution already supports
ssh://with ports:DependencyReference._parse_ssh_protocol_url()(src/apm_cli/models/dependency/reference.py, ~521-598). - That same file even directs users to the
ssh://form when an SCP path carries a port: "SCP shorthand can't carry a port. Use the ssh:// URL form instead" (~1370-1376). marketplace add's own error text lists "an SSH URL" among the accepted forms (lines 346-351).
A possible direction is recognizing ssh:// in _parse_marketplace_source() before the shorthand fallback, aligned with _parse_ssh_protocol_url() — but we defer to maintainers on the actual shape of the fix.
Workaround (verified on APM 0.27.0, macOS): rewrite at the git level and hand apm the https:// form. Note this is a global git config change affecting all git operations on the machine:
git config --global url."ssh://git@git-server.example.com:2222/".insteadOf "https://git-server.example.com/"
apm marketplace add https://git-server.example.com/org/repo.gitRelated: PR #1476 (Merged) added SCP-like SSH support, but its enumerated accepted forms do not include ssh:// URLs; #2063 / PR #2091 (Merged) preserve a registered SSH transport in dependency resolution, but don't touch marketplace add's URL parsing.
Disclosure: this report was drafted with AI assistance; all commands, outputs, and the workaround above were run and verified manually on the environment described.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Aug 4, 2026
Triage Panel Verdict -- #2464
Thanks for the detailed report and root cause analysis,
@ryodocx.Summary
apm marketplace adddoes not recognize(redacted) URLs. The_parse_marketplace_source()function has branches for local paths,(redacted) SCP-like SSH,https://, and shorthand, but no(redacted) branch. An(redacted) value falls through to the shorthand path, wheressh:is misread as the owner segment and GitHub is silently assumed as the host. The resulting mangled URL never resolves. This is a gap, not intentional scope exclusion: the function's own error message lists "SSH URL" as an accepted form, and dependency resolution already handles(redacted) with ports via_parse_ssh_protocol_url()`.Panel Findings
DevX UX Expert: The
(redacted) form is the only APM-native way to express SSH remotes on non-default ports (SCP shorthand cannot carry a port, as the source itself notes). Leavingmarketplace add` with no working syntax for that case is a blocker for self-hosted Git servers.Python Architect: Root cause is well-identified. Fix: add an
(redacted) branch in_parse_marketplace_source()before the shorthand fallback, reusing_parse_ssh_protocol_url()` or its equivalent logic. Bounded change, low regression risk.Supply Chain Security Expert: No additional security surface -- the fix normalizes a recognized URL scheme to the same
git ls-remotecode path used byhttps://.APM CEO: Clear gap with a known fix path, good reproduction case, and a verified workaround. Accepted.
Decision
type/bugtheme/portabilityarea/marketplacepriority/lowSuggested next action: Add an
(redacted) parsing branch in_parse_marketplace_source()(before the shorthand fallback), aligned with_parse_ssh_protocol_url(). Add a unit test covering(host/redacted) and `(host/redacted) input forms.Fix ssh:// URL not recognised by marketplace add (#2464)
fold: strengthen integration regression trap -- assert ssh:// URL pre…