Skip to content

[FEATURE] Support policy enforcement on non-GitHub remotes: add --policy to apm install (and/or auto-discovery for GitLab/ADO/plain git) #1925

Description

@lourenco00

Is your feature request related to a problem? Please describe.

On non-GitHub remotes there's no way to apply policy at install time. apm install has no --policy flag, and policy auto-discovery only works for GitHub/GHE remotes.
Both gaps are already documented in the Governance guide §14 ("Known gaps and limitations"). Per that section, when git remote get-url origin points to GitLab, ADO, or a plain git host, auto-discovery falls through with no policy applied, and the only documented mitigation is apm audit --ci --policy in CI.
That leaves a real hole: teams on a GitLab/ADO remote can gate at audit/merge time, but get zero enforcement at install time. For agent primitives, presence is effectively execution, a disallowed skill, steering file, or hook is active on the developer's workstation the moment it lands on disk, i.e. in the window between apm install and the eventual MR.
Audit-at-merge catches it before it reaches main, but not before it reaches the developer's machine. Orgs wanting defense-in-depth (block at install, not just at review) currently have no supported mechanism on non-GitHub remotes, short of baking the policy into a custom install image, which doesn't generalize across teams.

Describe the solution you'd like

Add a --policy flag to apm install, mirroring the flag apm audit already supports. It would apply the policy at install time and fail closed on violation, consistent with audit behaviour.
This is fully explicit, requires no remote detection, and lets any host (GitLab, ADO, plain git) point install at a vendored or internally-hosted policy.
Existing semantics should be preserved: tighten-only inheritance (enterprise → org → repo), and the existing cross-host extends: rejection (credential-leak mitigation) - a vendored same-host policy is unaffected.

Describe alternatives you've considered

Extending policy auto-discovery to non-GitHub remotes (GitLab/ADO/plain git) using the same git-host abstraction already used to resolve package dependencies, which works across these hosts today. This would remove the need to pass --policy explicitly, but it's a larger surface change. Happy to go this route instead if maintainers prefer it - the --policy flag just seemed the smaller, higher-leverage fix.
Audit-time gating only (apm audit --ci --policy …), the currently documented mitigation. This works for blocking at merge, but consciously accepts the install-to-MR workstation window with no enforcement, which is insufficient for teams that want install-time defense-in-depth.
Baking the policy into a custom install image. Works, but every consuming team has to build and maintain their own policy-bundling image rather than pointing install at an internal policy file, not generalisable.

Additional context

Both gaps are documented as known limitations in the Governance guide §14: https://microsoft.github.io/apm/enterprise/governance-guide/#14-known-gaps-and-limitations.
This request targets the install-time half. Related §9 air-gapped guidance already recommends apm audit --ci --policy ./vendored-policy.yml as the gating workaround, so a vendored/internally-hosted policy file is an established pattern; this just extends it to the install step.
Motivation is enterprise rollout on an internal GitLab host where install-time enforcement is wanted alongside the existing CI gate.

Activity

  1. added
    type/feature
    on Jun 26, 2026
  2. github-actions commented on Jun 26, 2026

    @github-actions

    Triage Verdict

    Classification: type/feature (existing) | theme/governance | theme/security | area/enterprise | area/cli
    Priority: priority/high
    Status: status/needs-design
    Milestone: v0.23.0

    Panel assessments

    DevX UX Expert: The UX proposal is well-formed: apm install --policy <path-or-url> mirrors the existing apm audit --policy surface, making it immediately learnable for current users. The --policy flag approach is lower-risk than extending auto-discovery. A vendored policy file pattern is already established in the air-gapped guidance (Governance guide SS9), so teams adopting this have a clear mental model.

    Supply Chain Security Expert: High-priority from a security perspective. Agent primitives execute on install -- a disallowed skill, steering file, or hook is active on the developer's workstation the moment apm install completes. The current install-to-MR gap means enforcement only happens at merge/review time, not at the moment of installation. The --policy flag closes this gap with minimal surface change. The existing cross-host extends: rejection (credential-leak mitigation) must be preserved and explicitly carried through to the --policy flag path on apm install.

    OSS Growth Hacker: This unblocks enterprise adoption on GitLab/ADO remotes. The known-gaps documentation in SS14 of the Governance guide signals this is expected/desired work. Fixing it removes a documented barrier to enterprise onboarding. An apm install --policy flag enables a compelling "install with guardrails" story for enterprise onboarding guides.

    APM CEO (arbiter): Accept with design gate. The use case is compelling, the solution is well-scoped, and the author has considered alternatives. However, apm install --policy introduces a new CLI contract that should be briefly specced before implementation: exact flag semantics (path vs URL resolution, fail-closed behavior), interaction with existing auto-discovery (does --policy suppress, augment, or override?), and error message wording on policy violation. Mark status/needs-design pending a brief spec comment. Once reviewed, this moves to status/accepted and implementation can begin. Target v0.23.0 if spec is completed quickly.

    Suggested next action

    Author or maintainer: draft a brief design comment covering (1) flag semantics for apm install --policy, (2) interaction with existing auto-discovery on GitHub remotes, and (3) fail-closed error behavior on violation. Once the spec is reviewed, replace status/needs-design with status/accepted. Supply chain reviewer should confirm the extends: cross-host rejection carries through to the --policy path.

    Labels applied

    theme/governance theme/security area/enterprise area/cli priority/high status/needs-design status/triaged
    (Note: type/feature was already present and is retained.)


    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 · 124.8 AIC · ⌖ 11.5 AIC · ⊞ 9.2K · ◷

  3. added
    area/cli
    area/enterprise
    priority/high
    status/needs-design
    status/triaged
    on Jun 26, 2026
  4. lourenco00 commented on Jul 15, 2026

    @lourenco00
    Author

    Hello team, any updates on this?

  5. rrazvd commented on Aug 12, 2026

    @rrazvd
    Contributor

    Filed a GitLab-specific report with a concrete reproduction on self-hosted GitLab (gitlab.example.com): #2566.

    Key GitLab-only detail beyond this umbrella issue: all four discovery repo names (.github-private, .github, .apm, _apm) are invalid GitLab project paths (GitLab forbids leading ., _, -), so even the ADO-style _apm fallback can't be created — a host-valid/configurable name is required. The apm install --policy flag proposed here would still fully unblock the install-time half for us.

  6. pfteter commented on Sep 1, 2026

    @pfteter

    ping - gitlab

  7. added
    triage/recommended
    on Sep 12, 2026
  8. 52 remaining items

  9. added a commit that references this issue on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/cliarea/enterprisepillar/governpriority/highstatus/acceptedtriage/recommendedtype/feature

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions