Agent supply chain security model
This page is for the security reviewer who has to sign off on APM. It lists every control APM provides, the defaults you start from, the threats each control answers, and what stays your responsibility. For why agent files are a supply chain at all, read The agent supply chain.
The question
Section titled “The question”A coding agent reads files from your repository: skills, instructions, prompts, agents, hooks, MCP and LSP server configuration, plugins. A harness, the agent tool that reads them (GitHub Copilot, Claude Code, Cursor, Codex and others), picks these files up as soon as they are on disk; there is no separate “run” step. Hooks and MCP servers also start processes on the developer’s machine. So the question is: what may land in those folders, who decided, and can you show it later?
Short answer
Section titled “Short answer”APM controls what gets installed: it declares, locks, verifies, scans and gates agent capabilities against an org policy, and exports an inventory. It does not control what runs: your harness does. APM is not a sandbox, verifies no signatures, and its lockfile records what arrived, not whether it deserves trust: whatever APM saw at adoption becomes the baseline.
APM checks in two layers:
- Built-in protection (automatic).
apm installblocks critical hidden-Unicode findings before files reach agent folders, refuses downloads whose content hash differs from the lockfile, and applies org policy.apm compileandapm packscan their output too. Zero configuration. apm audit(explicit). Reporting (SARIF, JSON, markdown), remediation (--strip), standalone file scanning (--file), and the CI gate (--ci) that replays the lockfile and re-checks policy.
The controls
Section titled “The controls”| Control | What APM does | What it does not do | Command |
|---|---|---|---|
| Declare | apm.yml lists every package and MCP server, once, for all harnesses | Judge whether a package is good | apm install <pkg> |
| Lock | apm.lock.yaml records the resolved commit, a SHA-256 content_hash per package and a hash per deployed file; marketplace installs also record which marketplace each package came from | Vouch for the initial download | apm install, apm lock |
| Verify | A download that differs from content_hash aborts the install; --frozen refuses a lockfile out of sync with apm.yml and deployed files that differ from their hashes | Verify signatures (no Sigstore, in-toto, SLSA or GPG) | apm install --frozen |
| Scan | Hidden Unicode (36 character ranges, plus mid-file BOMs) at install, compile, pack and audit; critical findings block deployment | Detect malware, visible prompt injection or misleading text | apm audit |
| Approve | Once the executables gate is on, hooks, MCP servers, LSP servers, bin/ and canvas from dependencies are parked until approved | Sandbox approved code, or cover code a hook downloads at run time | apm approve |
| Govern | Org policy allows or denies sources, MCP servers, transports and harnesses; inheritance tightens, never loosens; enforced at install and in apm audit --ci | Block anything under the default warn; govern user-scope (-g) installs | apm audit --ci --policy org |
| Detect drift | Replays the lockfile in a scratch folder and diffs the working tree | Watch files between runs; judge files APM did not write | apm audit |
| Inventory | CycloneDX 1.5 or SPDX 2.3 from the lockfile; apm find traces a file to its package | Attest anything: it is an inventory, not an attestation | apm lock export |
Defaults
Section titled “Defaults”Every default is permissive so adoption does not break teams. Harden them on purpose.
| Setting | Default | What happens |
|---|---|---|
Policy enforcement | warn | Violations print [!]; installs and apm audit --ci still pass |
Policy fetch_failure | warn | If a cached policy (up to 7 days old) cannot be refreshed, APM proceeds with the cached copy. With no usable cache, APM proceeds without a policy unless the repository sets policy.fetch_failure_default: block |
| Executables | Allowed | Hooks, MCP and LSP servers, bin/ and canvas deploy until the project declares an executables: block (formerly allowExecutables) or the org policy carries a non-empty executables: block |
security.integrity.require_hashes | false | Lockfile entries without a content hash are accepted |
Hardening checklist
Section titled “Hardening checklist”- Org policy:
enforcement: block,fetch_failure: block,security.integrity.require_hashes: true. See Set an org policy. - Each repository’s
apm.yml:policy.fetch_failure_default: block, so a missing or unreachable policy fails closed, and optionallypolicy.hashto pin the policy bytes. - Executables gate on, with an organization
recommendlist. See Control executables. - A required pull-request check that runs
apm policy status --check,apm install --frozenandapm audit --ci --policy org. See Gate pull requests. - CODEOWNERS and branch protection on the repository that holds
apm-policy.yml. - A review rule for workflow changes that add
--no-policy,APM_POLICY_DISABLE,--force,--trust-transitive-mcpor--allow-insecure.
Threat model
Section titled “Threat model”Each row names what an attacker wants, the control that answers it, and who owns the risk that remains.
| Attacker goal | Control | Residual risk owner |
|---|---|---|
| Change a package after you adopted it (moved tag, force-push, swapped archive) | Commit pin plus content_hash; a mismatching download aborts; --frozen in CI | You, at adoption: the lockfile trusts what it saw then |
| Get a malicious package or version adopted | Policy allow and deny lists; lockfile diffs in pull requests; approvals for executables | Your reviewers: APM does not judge content |
| Hide instructions in invisible characters | Hidden-Unicode scan blocks critical findings at install; apm audit reports and strips | Your reviewers, for visible prompt injection |
| Run code on developer machines through hooks or MCP servers | Executables gate and approvals | The harness, which governs what runs and with which permissions |
| Substitute a same-named package from another host (dependency confusion) | Host-qualified policy patterns such as github.com/contoso/**; *.ghe.com marketplaces refuse bare cross-repository sources | You: host-qualify allow patterns |
| Skip the policy on a laptop | --no-policy and APM_POLICY_DISABLE=1 are local; the required CI check runs anyway | You: branch protection makes the check required |
| Weaken or spoof the org policy | Inheritance never loosens; cross-host extends: rejected; an incomplete chain fails closed; policy.hash pin | Owners of the policy repository |
| Edit deployed agent files outside APM | Drift replay and content-integrity in apm audit --ci; --frozen | You, for files APM did not deploy (see unmanaged_files in the policy schema) |
| Forge a lockfile row so cleanup deletes a file APM never wrote | A lockfile hash alone never deletes: cleanup needs a local deployment receipt or byte equality with the locked render, and keeps and names any other file | You: delete kept files by hand once reviewed |
HTTPS transport trust
Section titled “HTTPS transport trust”APM keeps certificate verification on for every HTTPS request. Python-based paths verify
against the operating system’s trust store through truststore, so corporate roots that
git and curl trust are trusted by apm install too.
REQUESTS_CA_BUNDLEtakes precedence overCURL_CA_BUNDLE; either one replaces normal trust and turns off the OS and additive certificates.APM_DISABLE_TRUSTSTORE=1turns off OS and additive trust without unsetting a replacement bundle you configured separately.APM_EXTRA_CA_BUNDLEadds PEM certificates to APM’s package-management HTTPS and keeps the native roots. A selected bundle that is missing, unreadable, empty, over 8 MiB, malformed or contains a private key fails closed.- The Python
llmruntime gets its own.pthOS-trust bootstrap at venv setup;APM_EXTRA_CA_BUNDLEdoes not extend that bootstrap.
Git, the Node-based Copilot CLI and the Rust-based Codex CLI keep their own trust settings. See SSL / TLS issues.
HTTP (insecure) dependencies
Section titled “HTTP (insecure) dependencies”APM installs http:// git dependencies, for private mirrors and offline networks, when two
explicit approvals are both present: allow_insecure: true on the dependency in apm.yml, and
apm install --allow-insecure for the run. Transitive HTTP dependencies from another host
also need --allow-insecure-host HOSTNAME. APM never sends stored git credentials over HTTP.
These approvals make the decision visible; they do not protect the connection. HTTP has no encryption or server authentication, and the initial lockfile entry comes from that same channel.
Treat insecure transport as its own CI control. apm-policy.yml has no dedicated
allow_insecure field: dependencies.allow and dependencies.deny can name a host (see
dependency patterns) but match scheme-blind, so
they cannot distinguish http:// from https:// for the same package. An allow list
therefore does not enforce HTTPS. Reject committed allow_insecure: true entries in review,
and keep --allow-insecure and --allow-insecure-host out of standard CI.
registry_source.allow_non_registry is a separate source-routing control, not an
insecure-transport setting.
Git and gh executable discovery
Section titled “Git and gh executable discovery”APM never runs a git or gh executable from inside the project it is working
on, so a repository cannot plant one on PATH. Before searching PATH, APM
chooses a directory to exclude, called the exclusion root. It searches the
resolved current working directory and its parents in this order:
- The nearest directory containing
.git. - If no
.gitis found anywhere in that search, the nearest directory containing anapm.ymlfile. - If neither is found, the current working directory itself.
APM skips PATH directories and resolved executables located at this root or
in any of its subdirectories, including symlinks resolving back into it.
--global changes the installation scope, not these rules. If this hides your
only Git installation, see
Git discovery troubleshooting.
Content scanning
Section titled “Content scanning”apm install scans the files it is about to deploy, before any reaches an agent folder.
Critical findings (tag characters, bidirectional overrides, variation selectors 17-256,
unpaired surrogates)
block that package and the command exits 1; other packages still install. Warnings
(zero-width characters, bidirectional marks) deploy and are reported. --force
overrides a block. apm audit re-scans deployed files, apm audit --file <path> scans
any file, and apm audit --strip removes hidden characters from deployed copies.
Check names and severities: Baseline CI checks.
Inventory export (SBOM)
Section titled “Inventory export (SBOM)”apm lock export --format cyclonedx|spdx serializes what apm.lock.yaml already
recorded. It never re-resolves, re-hashes or touches the network. Licenses are the
license: each package declares in its apm.yml, validated against SPDX identifiers;
APM never reads LICENSE files, and an undeclared license is NOASSERTION in SPDX and
omitted in CycloneDX. Each component carries a package URL, such as
pkg:github/<owner>/<repo>@<commit>, and the lockfile’s SHA-256 content hash; SPDX output
sets filesAnalyzed: false because it lists packages, not files. See
Inventory and drift.
Source and license
Section titled “Source and license”APM is developed in the open at github.com/microsoft/apm; the source, build pipeline and release process are public. APM-owned software, bundled agent primitives, code examples and the software-facing OpenAPM specification are licensed under Apache-2.0. General documentation is licensed under CC-BY-4.0. LICENSING.md defines the scope and exclusions; Markdown agent primitives are software, not general documentation. Third-party material retains its license; attribution and the historical MIT notice are in NOTICE. APM collects no telemetry.
Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.