Skip to content

[Feature] Support host-qualified dependency allow/deny patterns for multi-host enterprise environments #3509

Closed

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-org on 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 only example-org on 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

These address related concerns but do not appear to cover host-aware dependency policy rules.

Activity

  1. added
    type/feature
    on Nov 10, 2026
  2. danielmeppiel commented on Nov 12, 2026

    @danielmeppiel
    Collaborator

    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)

  3. danielmeppiel commented on Nov 12, 2026

    @danielmeppiel
    Collaborator

    The apm-scope:v1 record 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 configured GITHUB_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).

  4. added
    status/accepted
    area/audit-policy
    on Nov 12, 2026
  5. added
    pillar/govern
    on Nov 12, 2026
  6. added a commit that references this issue on Nov 13, 2026
    a2c63ef
  7. moved this from In Progress to Done in APM Roadmapon Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/audit-policypillar/governstatus/acceptedtype/feature

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions