Repository navigation
Description
Is your feature request related to a problem? Please describe.
We need a central APM policy that allows packages from our approved enterprise hosts and one approved GitHub.com organization, while rejecting all other sources, including transitive dependencies.
In apm-cli 0.35.0, dependency policy matching uses get_canonical_dependency_string(), which omits the hostname.
Testing showed that host-qualified patterns do not match the intended packages, while example-org/** matches that organization name on both GitHub.com and unapproved hosts.
The current organization-based allow-lists therefore cannot enforce our source restrictions.
Describe the solution you'd like
Support dependency allow/deny rules that distinguish both the hostname and organization.
An policy goal might be:
- Allow any organization on our approved GitHub Enterprise Server host.
- Allow any organization on our approved GitHub Enterprise Cloud data-residency host (
<enterprise>.ghe.com). - Allow only
example-orgon GitHub.com. - Reject all other hosts and GitHub.com organizations.
Host-qualified patterns would be one way to express this, but an equivalent host-and-organization policy model would also work.
We would consider this working when:
- The rules apply to direct and transitive dependencies during install preflight and policy audits.
- Equivalent shorthand, HTTPS, and SSH references are handled consistently.
- Hostnames are matched exactly, without accepting lookalike domains or unintended subdomains.
- Compatibility with existing hostless patterns is explicitly defined.
This request concerns package-source governance, not runtime permissions or sandboxing.
We welcome maintainer guidance on the preferred approach before implementation.
Describe alternatives you've considered
- A separate allowed-hosts setting: Restricts hosts, but does not by itself bind organization rules to specific hosts.
We need to allow every organization on our enterprise hosts while allowing onlyexample-orgon GitHub.com.
Independent host and organization lists cannot express that distinction. - Host-qualified patterns in the current schema: Tested, but they do not match because dependency identities omit the hostname.
- An external host-validation gate: Would duplicate source-validation logic outside APM and require integration with both installation and CI, including checks for transitive dependencies.
Related issues
- Multi-host dependency support: lockfile identity, token resolution consistency, error clarity #773: Host omission in lockfile identity, rather than dependency policy matching.
- [BUG] Mixed-host
apm installdoes not preserve explicit package hosts #2775: Preserving explicit hosts during mixed-host installs. - [FEATURE] Support policy enforcement on non-GitHub remotes: add --policy to apm install (and/or auto-discovery for GitLab/ADO/plain git) #1925: Selecting an explicit policy at install time.
These address related concerns but do not appear to cover host-aware dependency policy rules.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
danielmeppiel commentedon Nov 12, 2026
Decision: approve
Area: project
Scope: Make dependency policy allow and deny matching host-aware for every dependency: resolve each direct and transitive dependency to its effective host (explicit host, or the default host from configuration such as GITHUB_HOST or github.com when none is written) and evaluate host-qualified patterns such as github.com/example-org/** or ghes.corp.example/** against that effective host plus owner/repo path, with exact host matching (no lookalike domains or implicit subdomains); keep existing hostless patterns matching any host for compatibility and document that explicitly; normalize shorthand, HTTPS and SSH references to the same identity; apply in install preflight and apm audit.
Done when: Tests show a hostless dependency such as example-org/repo is gated by host-qualified rules using its default host (allowed by github.com/example-org/**, rejected by a github.com rule for a different org, and rejected when GITHUB_HOST points to an unapproved host); explicit-host dependencies match only their own host; lookalike and subdomain hosts do not match; shorthand, HTTPS and SSH forms give identical results; transitive dependencies are gated at install and audit; existing hostless policies behave as before; the host-recognition rule is unambiguous and tested (including dotted GitLab group names); policy docs and the apm-usage governance guide are updated.
Out of scope: Changing lockfile identity (#773); runtime permissions or sandboxing; MCP or registry source policy; a separate allowed-hosts setting; new CLI flags.
Review contact: Daniel Meppiel (@danielmeppiel)
danielmeppiel commentedon Nov 12, 2026
The
apm-scope:v1record above was approved by Daniel Meppiel (@danielmeppiel) on 2026-11-12. Key point beyond the request: every dependency is gated by host-qualified rules, including ones written without a host, which are evaluated against the host they actually resolve to (default github.com or the configuredGITHUB_HOST). Existing hostless patterns keep matching any host for compatibility. Thank you for the precise report and acceptance criteria.Posted with AI assistance on behalf of Daniel Meppiel (@danielmeppiel).
docs(spec): fold spec-guardian items into req-pl-018 clause (g)
feat(policy): host-qualified dependency allow/deny patterns (microsof…