Repository navigation
Description
Describe the bug
For a marketplace registered on a non-GitHub/ADO host (self-managed GitLab in our case), apm install <plugin>@<marketplace> for an in-marketplace subdirectory plugin always writes an explicit https:// git: URL into the consumer's apm.yml — even when the marketplace itself was registered with an SSH URL. This forces every single-plugin install through a doomed HTTPS attempt (no credential available, SSH-key-only environment) before --allow-protocol-fallback lets it retry over SSH, on every invocation, for
every plugin.
I'm not fully certain this is unintended vs. a deliberate (if undocumented) choice — see "Additional context" below for what I found while digging, and please correct me if this is by design.
To Reproduce
Steps to reproduce the behavior:
- Register a marketplace via an SSH URL:
apm marketplace add git@gitlab.mycompany.com:team/packages/toolkit.git --name my-marketplace
- In a fresh project, install a plugin that lives in a subdirectory of that marketplace's repo (e.g. a skill at
skills/some-skill):mkdir /tmp/repro && cd /tmp/repro apm init . --yes --target opencode apm install some-skill@my-marketplace
- Inspect the generated
apm.yml
Expected behavior
The resolved dependency should preserve the transport scheme the marketplace was registered with — SSH registration -> SSH-scheme resolved dependency, HTTPS registration -> HTTPS-scheme resolved dependency. Instead it's always HTTPS regardless of registration.
Resulting apm.yml (actual):
dependencies:
apm:
- git: https://gitlab.mycompany.com/team/packages/toolkit
path: skills/some-skillExpected, given step 1 registered via git@... SSH:
dependencies:
apm:
- git: git@gitlab.mycompany.com:team/packages/toolkit.git
path: skills/some-skillEnvironment (please complete the following information):
- OS: Linux
- Python Version: 3.13.14
- APM Version: 0.23.1
Logs
Install fails outright without allow-protocol-fallback (no HTTPS credential configured, by policy — SSH keys only):
Failed to download dependency ai/packages/development: Failed to clone repository: Failed to clone repository ai/packages/development via plain HTTPS. To allow cross-protocol fallback (not recommended), pass --allow-protocol-fallback, set APM_ALLOW_PROTOCOL_FALLBACK=1, or run: apm config set allow-protocol-fallback true For private repositories on gitlab.mycompany.com, configure SSH keys or a git credential helper. APM delegates authentication to git for non-GitHub/ADO hosts.
With allow-protocol-fallback set, it works, but every install still pays for one guaranteed-failing HTTPS round-trip first, plus a log line, every time:
[!] Protocol fallback: plain HTTPS clone of team/packages/toolkit failed; retrying with SSH.
apm config set prefer-ssh true does not help — from reading apm_cli/deps/transport_selection.py, prefer-ssh only changes the initial protocol for schemeless shorthand dependencies; it has no effect once a dependency already carries an explicit scheme (which this one does).
Additional context
I found #1519, which explicitly scopes out "SSH SCP form (git@host:path)" for marketplace.packages[].source as "rejected by #1288 for confused-deputy reasons". Want to be explicit that this report is not about that: marketplace.packages[].source entries are potentially third-party-authored content inside a fetched marketplace.json, and accepting ambient-SSH there is a real confused-deputy risk. What I'm describing is different: ~/.apm/marketplaces.json's url field is not third-party content — it's the exact string the consumer typed themselves when running apm marketplace add <url>, already fully trusted by them. Whether the resolved per-plugin dependency should default to that same, already-consumer-chosen scheme seems like a separate, narrower question with a different trust boundary — but flagging the connection in case maintainers see it differently.
Workaround in use today: apm config set allow-protocol-fallback true (works, with the guaranteed-failed-attempt cost described above), or manually rewriting the generated apm.yml entry's git: https://... to git@host:... after each new plugin install to get a clean single-attempt SSH dependency going forward.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Jul 7, 2026
Triage decision
acceptProposed labels
Milestone
null-- no current patch milestone open against 0.24.0.Suggested next action
In the marketplace plugin resolution path, propagate the transport scheme from the marketplace's registered URL (
~/.apm/marketplaces.jsonurlfield) to the resolvedgit:dependency written into the consumer'sapm.yml, instead of converting to HTTPS.Suggested issue comment
Per-lens notes (collapsed)
DevX UX Expert -- User-Need Reviewer
The user registered a marketplace with SSH (their choice, their trust level), installed a plugin, and got an HTTPS dependency in
apm.yml. In an SSH-key-only environment, every subsequentapm installfails and retries via SSH with a guaranteed-failing HTTPS round-trip.prefer-sshdoes not help. The user must either setallow-protocol-fallback(accepting the penalty) or hand-editapm.ymlafter every plugin install. This is a real friction point in enterprise environments where HTTPS credentials are deliberately not configured.Supply Chain Security Expert -- Risk-Surface Reviewer
The author correctly identifies the trust-boundary distinction from #1519. The
urlin~/.apm/marketplaces.jsonis consumer-typed input (the user explicitly ranapm marketplace add git@...) -- it is not third-party content frommarketplace.packages[].source. Preserving the user-chosen transport scheme for consumer-registered marketplace URLs is the correct behavior and does not introduce a confused-deputy risk. The fix scope is narrow: the marketplace dependency resolution path only.area/marketplaceandarea/distributionare both implicated.OSS Growth Hacker -- Contributor-Tone Reviewer
Author
pavelvodrazka-etneterahasauthor_association: NONE. The report is outstanding: the author cites relevant prior issues, explicitly scopes their report away from the declined request, identifies the exact source of the problem (transport_selection.py), explains whyprefer-sshdoes not apply, and provides a workaround. This is enterprise-quality bug reporting. Tone should be warm and validate the quality of the analysis and the correctness of the trust-boundary reasoning.Python Architect -- Architecture Reviewer
The fix is bounded to the marketplace plugin resolution path. When resolving a
plugin@marketplaceinstall and writing the resultinggit:URL toapm.yml, the transport should be derived from the marketplace's registered URL rather than defaulted to HTTPS. The author's read oftransport_selection.pyis accurate. The fix should preserve existing behavior for HTTPS-registered marketplaces (no change) and fix the scheme propagation for SSH-registered ones. Cross-module consideration: the fix touches the same transport layer the author identified. No new interface design needed.Doc Writer -- Documentation Reviewer
Not activated -- bug fix to transport scheme propagation. No new user-facing documentation needed beyond potentially a brief note in the marketplace docs clarifying that the registered transport is preserved.
APM CEO -- Triage Arbiter
Real enterprise pain point. SSH-key-only environments are common in regulated industries and enterprise devcontainer setups. The fix is bounded and correct, and the trust model reasoning is sound.
priority/highbecause the failure is every-install, immediate, and requires a workaround that has an ongoing cost (failed HTTPS round-trip). Milestone null -- no open patch milestone for 0.24.x.{ "decision": "accept", "decision_detail": "", "theme": "theme/portability", "areas": ["area/marketplace", "area/distribution"], "type": "type/bug", "status": "status/accepted", "priority": "priority/high", "preserved_labels": [], "milestone": null, "next_action": "Propagate the transport scheme from the marketplace's registered URL to the resolved git: dependency in apm.yml instead of normalizing to HTTPS.", "comment_markdown": "Thanks for the careful research and for explicitly scoping this to the user-registered marketplace URL (not the third-party `marketplace.packages[].source` field that #1519 concerned) -- the trust-boundary distinction is correct and this is a different, narrower question.\n\nThis is confirmed as a bug. When a marketplace is registered via an SSH URL, the resolved per-plugin dependency written into `apm.yml` should use the same transport scheme as the registration. Converting to HTTPS produces a dependency that fails immediately in SSH-key-only environments, and `prefer-ssh` does not help because the dependency already carries an explicit scheme.\n\nThe fix is in the marketplace plugin resolution path: when writing the resolved `git:` dependency into `apm.yml`, use the transport from the marketplace's own registered URL rather than normalizing to HTTPS. HTTPS-registered marketplaces would continue to produce HTTPS dependencies (existing behavior preserved); SSH-registered marketplaces would produce SSH dependencies.\n\nYour note on `prefer-ssh` and `allow-protocol-fallback` is accurate and useful -- it means the current workaround is to set `allow-protocol-fallback` and accept the failing HTTPS round-trip, or to manually rewrite the `git:` line in `apm.yml` after each new plugin install." }test(marketplace): prove SSH reaches install pipeline
fix(marketplace): preserve registered SSH transport (#2091)