Repository navigation
Description
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Jun 26, 2026
Triage Verdict
Classification:
type/feature(existing) |theme/governance|theme/security|area/enterprise|area/cliPriority:
priority/highStatus:
status/needs-designMilestone: v0.23.0
Panel assessments
DevX UX Expert: The UX proposal is well-formed:
apm install --policy <path-or-url>mirrors the existingapm audit --policysurface, making it immediately learnable for current users. The--policyflag 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 installcompletes. The current install-to-MR gap means enforcement only happens at merge/review time, not at the moment of installation. The--policyflag closes this gap with minimal surface change. The existing cross-hostextends:rejection (credential-leak mitigation) must be preserved and explicitly carried through to the--policyflag path onapm 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 --policyflag 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 --policyintroduces 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--policysuppress, augment, or override?), and error message wording on policy violation. Markstatus/needs-designpending a brief spec comment. Once reviewed, this moves tostatus/acceptedand 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, replacestatus/needs-designwithstatus/accepted. Supply chain reviewer should confirm theextends:cross-host rejection carries through to the--policypath.Labels applied
theme/governancetheme/securityarea/enterprisearea/clipriority/highstatus/needs-designstatus/triaged(Note:
type/featurewas already present and is retained.)lourenco00 commentedon Jul 15, 2026
Hello team, any updates on this?
rrazvd commentedon Aug 12, 2026
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_apmfallback can't be created — a host-valid/configurable name is required. Theapm install --policyflag proposed here would still fully unblock the install-time half for us.pfteter commentedon Sep 1, 2026
ping - gitlab
52 remaining items
feat(policy): add --policy to apm install and apm update (#1925)
fix(policy): route --policy composition through the 0.37 outcome owner (
spec(normative, pending Daniel): explicit policy source composition f…
docs: document apm install/update --policy (#1925)
test(policy): register --policy option guard; regenerate E01 golden (#…
spec: renumber the #1925 amendment proposal to 0.1.75
test(lifecycle): re-cite audit.py anchors after the --policy source l…
wip: #4001 fail closed on an unloadable --policy (#1925)
feat(policy): an unloadable --policy source fails closed (#1925)
fix(policy): route a named --policy with no dependencies; review folds (
spec: adopt amendment 0.1.75 (CEO sign-off D5); changelog fragment (#…
docs(apm-usage): an unloadable --policy source always blocks (#1925)
Merge pull request #4001 from microsoft/danielmeppiel-literate-carnival