-
Notifications
You must be signed in to change notification settings - Fork 156
bug: apm install plugin@marketplace validation bypasses registry proxy #615
Copy link
Copy link
Open
Labels
acceptedDeprecated: use status/accepted. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use status/accepted. Kept for issue history; will be removed in milestone 0.10.0.area/content-securityUnicode scanning, Glassworm, apm audit content checks, SARIF output.Unicode scanning, Glassworm, apm audit content checks, SARIF output.area/marketplacemarketplace.json schema, federation, authoring suite, source parity.marketplace.json schema, federation, authoring suite, source parity.bugDeprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.priority/highShips in current or next milestoneShips in current or next milestonestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/securitySecure by default. Content scanning, lockfile integrity, MCP trust boundaries.Secure by default. Content scanning, lockfile integrity, MCP trust boundaries.type/bugSomething does not work as documented.Something does not work as documented.
Milestone
Metadata
Metadata
Assignees
Labels
acceptedDeprecated: use status/accepted. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use status/accepted. Kept for issue history; will be removed in milestone 0.10.0.area/content-securityUnicode scanning, Glassworm, apm audit content checks, SARIF output.Unicode scanning, Glassworm, apm audit content checks, SARIF output.area/marketplacemarketplace.json schema, federation, authoring suite, source parity.marketplace.json schema, federation, authoring suite, source parity.bugDeprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.priority/highShips in current or next milestoneShips in current or next milestonestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/securitySecure by default. Content scanning, lockfile integrity, MCP trust boundaries.Secure by default. Content scanning, lockfile integrity, MCP trust boundaries.type/bugSomething does not work as documented.Something does not work as documented.
Type
Projects
Status
Todo
Bug
When
PROXY_REGISTRY_ONLY=1andPROXY_REGISTRY_URLare set,apm install plugin@marketplacestill hits the GitHub API directly during the package validation phase. This breaks the air-gapped guarantee.Reproduction
Output shows direct GitHub API call during validation:
In a truly air-gapped environment (no GitHub access), validation fails and blocks install even though the download itself would succeed through Artifactory.
Root Cause
_validate_package_exists()incommands/install.py(line 337) has three code paths:validate_virtual_package_exists()which uses GitHub API -- leaks.api.github.com/repos/{owner}/{repo}viaAuthResolver.try_with_fallback()-- leaks.None of these paths check
RegistryConfigor route through the proxy.Impact
With
PROXY_REGISTRY_ONLY=1:apm marketplace add/browse/search-- will work via proxy (after feat: Support Artifactory-hosted marketplace indexes #506)apm install plugin@marketplace-- fails in air-gapped at validation stepapm install owner/repo-- same failure at validation stepapm install(from lockfile, no new packages) -- works (skips validation)Suggested Fix
Add a proxy-aware validation path in
_validate_package_exists(). WhenRegistryConfig.from_env()returns a config, validate through Artifactory instead of GitHub API.Option A: Validate via Archive Entry Download (lightweight)
Use
fetch_entry_from_archive()to probe for a known file (e.g., check if the archive is accessible). This reuses the existing #525 infrastructure:Where
_validate_via_proxy():Option B: Skip validation for proxy installs
When
RegistryConfigis active, trust the marketplace resolution and skip the GitHub API validation entirely. The download step will fail with a clear error if the package doesn't exist in Artifactory.Option B is simpler but less informative on failure. Option A gives better error messages.
Affected Code
src/apm_cli/commands/install.pylines 337-504:_validate_package_exists()api_url = f"{api_base}/repos/{dep_ref.repo_url}"virtual_downloader.validate_virtual_package_exists(dep_ref)Related
_parse_artifactory_base_url()ignoresPROXY_REGISTRY_URL(lockfile reinstall)PROXY_REGISTRY_URLcanonical env varfetch_entry_from_archive()infrastructure