Skip to content

[BUG] apm install <plugin>@<marketplace>: resolved git+path dependency doesn't preserve the marketplace's own registration scheme (always becomes HTTPS) #2063

Closed

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:

  1. Register a marketplace via an SSH URL:
    apm marketplace add git@gitlab.mycompany.com:team/packages/toolkit.git --name my-marketplace
  2. 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
  3. 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-skill

Expected, given step 1 registered via git@... SSH:

dependencies:
  apm:
  - git: git@gitlab.mycompany.com:team/packages/toolkit.git
    path: skills/some-skill

Environment (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.

Activity

  1. added
    type/bug
    on Jul 7, 2026
  2. github-actions commented on Jul 7, 2026

    @github-actions

    Triage decision

    accept

    Proposed labels

    theme/portability
    area/marketplace
    area/distribution
    type/bug
    status/accepted
    priority/high
    

    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.json url field) to the resolved git: dependency written into the consumer's apm.yml, instead of converting to HTTPS.

    Suggested issue comment

    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.
    
    This 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.
    
    The 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.
    
    Your 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.

    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 subsequent apm install fails and retries via SSH with a guaranteed-failing HTTPS round-trip. prefer-ssh does not help. The user must either set allow-protocol-fallback (accepting the penalty) or hand-edit apm.yml after 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 url in ~/.apm/marketplaces.json is consumer-typed input (the user explicitly ran apm marketplace add git@...) -- it is not third-party content from marketplace.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/marketplace and area/distribution are both implicated.

    OSS Growth Hacker -- Contributor-Tone Reviewer

    Author pavelvodrazka-etnetera has author_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 why prefer-ssh does 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@marketplace install and writing the resulting git: URL to apm.yml, the transport should be derived from the marketplace's registered URL rather than defaulted to HTTPS. The author's read of transport_selection.py is 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/high because 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."
    }

    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 · 184.7 AIC · ⌖ 18.6 AIC · ⊞ 9.2K · ◷

  3. added
    area/distribution
    area/marketplace
    priority/high
    status/accepted
    status/triaged
    on Jul 7, 2026
  4. moved this from Todo to In Progress in APM Roadmapon Jul 9, 2026
  5. moved this from In Progress to Done in APM Roadmapon Jul 10, 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/distributionarea/marketplacepriority/highstatus/acceptedstatus/triagedtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions