Skip to content

[BUG] apm marketplace add does not recognize fully-qualified ssh:// URLs #2464

Closed

Description

@ryodocx

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 $?
1

The 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/apm tap)

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.git

Related: 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.

Activity

  1. added
    type/bug
    on Aug 4, 2026
  2. moved this from Todo to In Progress in APM Roadmapon Aug 4, 2026
  3. github-actions commented on Aug 4, 2026

    @github-actions

    Triage Panel Verdict -- #2464

    Thanks for the detailed report and root cause analysis, @ryodocx.

    Summary

    apm marketplace add does 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, where ssh: 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). Leaving marketplace 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-remote code path used by https://.

    APM CEO: Clear gap with a known fix path, good reproduction case, and a verified workaround. Accepted.

    Decision

    Dimension Value
    Type type/bug
    Theme theme/portability
    Area area/marketplace
    Priority priority/low
    Milestone (omitted -- maintainer call)

    Suggested 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.


    Triage status: agentic proposal pending human ratification.
    Silence is approval. Maintainers can:

    • Override any label or milestone above by editing it directly --
      human edits are authoritative and will not be reverted on
      subsequent runs.
    • Re-trigger triage by applying the status/needs-triage label, or
      by removing status/triaged to enroll the issue in the next
      daily sweep.

    Posted by the Triage Panel workflow. See .apm/skills/apm-triage-panel for the panel skill.

    Generated by Triage Panel · 88.9 AIC · ⌖ 9.15 AIC · ⊞ 9.2K · ◷

  4. added
    area/marketplace
    priority/low
    status/triaged
    on Aug 4, 2026
  5. added a commit that references this issue on Aug 6, 2026
    8aafbc0
  6. moved this from In Progress to Done in APM Roadmapon Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/marketplacepriority/lowstatus/triagedtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions