Skip to content

feat(security): portable, content-pinned approval for dependency executables (#3902) - #3918

Merged
Daniel Meppiel (danielmeppiel) merged 11 commits into
mainfrom
danielmeppiel-portable-mcp-approval
Nov 19, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 11 commits into
mainfrom
danielmeppiel-portable-mcp-approval

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

TL;DR. Approvals for dependency executables now live in apm.yml, pinned to what actually runs: each MCP server and each hook file gets a full SHA-256 of its definition. One owner, security/trust.py admit(), makes the decision for install, update, install --frozen, apm audit --ci, apm approve and the install prompt. Two clones with the same apm.yml and apm.lock.yaml therefore get the same .mcp.json and lock without any flag. A changed upstream definition is parked with a re-approve message, and the lockfile stays evidence only, never consent.

Problem (WHY)

Approach (WHAT)

Decision Single owner Consumers
Is this item admitted? security/trust.py admit(), McpAdmission, hook_file_filter, admit_native_plugin, record_pins CurrentMcpConfigView.select(admission=...) (the #3938 factory, now gated by the trust owner), the frozen comparison, audit config-consistency, the exec gate, the source plan, hook reintegration, native plugins, apm approve, the install prompt
Fingerprint security/trust_fingerprint.py approval pins; MCP omission evidence and the local-bundle digest moved here byte-identical, so no lock churn
Consent store apm.yml executables.allow.<pkg>.<type>.<item>: sha256:<64 hex>; a native plugin uses one executables.allow.<pkg>.plugin: sha256:<64 hex> (--user: same shape in the personal config) parsing splits pins from true grants, so a bool caller can never read a pin as "any content"

The design was approved as revision 2 of the design doc (binding record). Daniel's decisions:

  • D1: the first approval confirms on a TTY.
  • D2: legacy mcp: true never satisfies transitive trust.
  • D3: one pin per hook file (split installs).
  • Native plugins (Daniel, 2026-11-19): ONE pin over the whole plugin root, files plus executable bits.
  • D4: --user grants stay local, and audit never reads them.
  • D6: audit --ci enforces consent.
  • D9: registry-resolved servers are not pinned offline.
  • D11: pinned grants require APM 0.37 or later.
  • Fingerprints use the full 64 hex.
  • Legacy true now warns.

Implementation (HOW)

Area Change
security/trust.py (new) The admission ladder: deny, then pin (match admits; mismatch parks as definition-changed), then transitive trust, then the executables gate. It also covers per-file hook admission, native-plugin admission and pin recording. Its warnings are the one-off notice and the legacy-grant notice. package_type_verdicts() is the single per-type verdict reader for policy explain, approve --list/--pending, doctor, lockfile exec_status and native status, and one MCP enumerator (package_mcp_declarations + is_pinnable_mcp) feeds install, status and pins.
security/trust_fingerprint.py (new) native_plugin_fingerprint(root) is the canonical native bundle hash (relpath, executable bit, sha256 per file), so the approved source and the deployed copy compare equal. Canonical JSON with domain separation. MCP inputs: transport, command, args, env (values or ${VAR}), url, headers, cwd, registry, version, package, tools, enabled and extra, plus the resolved registry entry for pinned overlays. Hook inputs: the hook document plus the bytes of every referenced script.
security/executables.py Item-form parsing and validation. is True checks are used everywhere. EffectiveExecMap carries the trust context. include_user exists for audit. The dead read_bundle_allow_executables is removed.
integration/mcp_config_view.py derive(admission=) replaces trust_transitive_self_defined and #3893's with_unapproved_executables. consent_problems() covers servers the lock admits that apm.yml does not approve.
install/service.py, policy/ci_checks.py, commands/uninstall/engine.py Frozen and install use the same admission. Audit uses the project layer plus cached org policy, never --user, and reports definition-changed parking. Uninstall uses admit_all(), as before. #3938 landed the frozen executables gate first; this PR routes its CurrentMcpConfigView.select factory through McpAdmission instead of an approve callable, so install, both --frozen checks and audit share one admission. Audit passes exact=False (structural evidence) and still re-checks consent.
install/exec_gate.py, deployment_plan.py, deployable_source_plan.py, hook_reintegration.py, native_plugin_admission.py Pinned hook files are admitted per file at the source-plan chokepoint (split installs, unchanged). A whole-plugin plugin: pin decides every executable type of the package at once through admit_native_plugin; any byte or mode change parks the plugin with Parked native plugin <pkg>: content changed since approval and the re-approve command. Per-file hook pins never admit a native plugin. A refusal folds exec_status to gated, which retires the registration. check_executable_approval stays a thin view over the owner.
commands/approve.py Lists each item (command or URL, env keys; ${VAR} and code-loading values shown) and verifies installed bytes against the lock. It narrows legacy grants with a notice, and confirms the first approval on a TTY. --pending and --list show per-item states; a native plugin shows one plugin . whole plugin, N files (...) item (8-hex display, 64-hex stored). [+] Approved prints only after the write; refusals and a declined prompt exit 1; the first pin hints Teammates need APM 0.37 or later.
Guards install-deployment-executable-item-admission, -trust-fingerprint and -mcp-admission are registered in .apm/architecture/owners/install-deployment.json, each with a sorted MutationCase and an _EXPECTED_RULE_ID_TEXT entry.
Spec OpenAPM amendment 0.1.64 (proposed): req-sc-016 in §10.13, and req-sc-011 extended to frozen install. §1.3, §10.11 row 26, §11.3.2, Appendix C, the requirements manifest and CONFORMANCE are updated; the statement count goes from 147 to 148 (after 0.1.65). The apm-spec-guardian panel's three convergent blockers were folded into req-sc-016: the fingerprint is defined normatively, per-user pins are admitted, and a stale pin is never overridden by the one-off flag. Ship decision: fold_and_ship (guardian comment).

Diagram

Admission ladder admit() applies to every dependency-declared MCP server or hook file (root-declared items are admitted as before):

flowchart LR
  A["dependency item: MCP server or hook file"] --> B{"org / user / project deny?"}
  B -->|"yes"| P1["park: denied"]
  B -->|"no"| C{"pin in apm.yml?"}
  C -->|"matches"| OK["admit"]
  C -->|"differs"| P2["park: definition-changed"]
  C -->|"none"| D{"transitive, needs trust?"}
  D -->|"yes, no flag"| P3["park: untrusted-transitive"]
  D -->|"no, or flag this run"| E{"executables gate on?"}
  E -->|"off"| OK
  E -->|"type grant"| OK
  E -->|"none"| P4["park: unapproved-executables"]
Loading

Native plugin seam (for #3290)

# src/apm_cli/security/trust.py
def admit_native_plugin(
    allow_executables,             # EffectiveExecMap | ExecTrustContext | None (gate off)
    package_keys: tuple[str, ...], # approval keys, e.g. (key_with_version, version_blind_key)
    plugin_root: Path,             # the apm_modules source
) -> Admission                     # Admission(allowed, reason, layer)

# src/apm_cli/security/trust_fingerprint.py
def native_plugin_fingerprint(plugin_root: Path) -> str  # "sha256:<64 hex>"
Plugin root Verdict
gate off (None or no executables: opt-in) allowed
declares no executables (hooks, MCP, LSP, bin, canvas, or root agents/commands/instructions) and has no pin allowed, no pin needed
org, user or project deny on any declared type (with a pin, checked even when no type is detected) parked, denied (wins over a matching pin)
an executable surface (manifest, hooks/, bin/, .mcp.json, .lsp.json) references root .apm/ or apm.yml parked, apm-owned-reference; Admission.detail names the file and reference
plugin: pin equals native_plugin_fingerprint(plugin_root) allowed
plugin: pin differs (any byte, added file or mode change) parked, definition-changed
no pin, every declared type granted by a legacy true allowed, with the 0.37 warning
otherwise parked, unapproved-executables

The fingerprint is utils/content_hash.compute_native_plugin_hash over native_plugin_files(plugin_root): the native bundle minus APM's root apm.yml and root .apm/, as path, exec bit and sha256 per file. It equals compute_native_bundle_hash of a deployed copy of that file set (req-na-002; tested). #3290 requires the deployed copy to match.

A plugin pin is honoured only on the native path (exec_gate.native_install: an admitted Copilot Agent Plugin or a Codex bundle). apm approve records split-install item pins beside the plugin pin, so a split install of the same package never reads the whole-root pin.

Trade-offs

  • Full 64-hex pins over truncation. The upstream author writes both definitions, so a collision is the relevant attack; 128-bit truncation leaves about 2^64 work. The CLI shows 8 hex characters for display only.
  • Native plugins are one unit. A harness loads an intact plugin directory, including files it reaches only indirectly (a dispatcher calling a sibling script) and other-harness variants. A whole-root pin is the honest unit; the cost is that any upstream commit to the plugin re-gates it.
  • Hook pin scope. A hook pin covers the hook JSON plus the scripts APM copies. Code a hook downloads at run time (npx, curl) is outside the binding, and the docs say so. The rejected alternative was a whole-package pin, which re-gates on every commit.
  • Audit consent (D6) is breaking by design. A lock produced with a one-off --trust-transitive-mcp run now fails config-consistency. Three existing lifecycle tests now persist consent with apm approve before audit (test_mcp_omission_lifecycle.py, test_mcp_deliberate_omission_audit_lifecycle.py, test_mcp_dev_dependency_lifecycle.py).
  • Org deny wins everywhere. It also parks a pinned transitive registry overlay and beats the one-off flag; before this PR, deny applied only to self-defined servers.
  • The one-off flag never overrides a pin. A changed definition, self-defined or registry overlay, always needs apm approve (req-sc-016; folded from the spec panel).
  • Audit consent discovers org policy like install (honoring --no-policy) and names an unavailable policy in the config-consistency message instead of silently passing.
  • Hook retirement. fix(install): retire a package's hooks when apm deny or a removed approval gates them #3944 (landed first) retires a package's merged hook entries when the gate withholds them; this PR's pinned-item parking composes with it (a pinned hook awaiting re-approval parks; a hard deny is reported as denied). Native plugins retire through exec_status (above).

Benefits

  1. Two clones with the same apm.yml and apm.lock.yaml produce identical .mcp.json and lock with no flags (lifecycle test (a)).
  2. --frozen and apm audit --ci reach the install verdict for gate-parked and approved servers (b, c).
  3. An upstream change to a pinned MCP server or hook script is never deployed unreviewed (d, hook and native tests).
  4. A lockfile-only edit cannot grant trust in install, frozen or audit (e).
  5. One decision owner, one hasher, and three guards, each with mutation proof.

Out of scope (deferred per the record; no issues filed)

  • Parking name conflicts between two declarers (D10).
  • apm approve -g (D7).
  • Enforcing the org mcp.trust_transitive key, which is still parsed and still unenforced.
  • Consent stored in apm.lock.yaml.
  • Org policy semantics.

Issue and approved scope

Issue: Fixes #3902

Human scope-approval comment: #3902 (comment) (it supersedes #3902 (comment))

This PR completes the issue: every Done-when item is covered below. Hook approvals were bound only to the package name (security/executables.py:352-376 on main) and are now content-bound per hook file. Local-bundle approvals were already content-bound (local_bundle_approval_key) and are unchanged.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Scenario evidence (blast-radius matrix)

Row Scenario Test Principle
13, 22 (a) two clones, no flags, identical .mcp.json and lock test_mcp_portable_approval_lifecycle.py::test_two_clones_reproduce_an_approved_transitive_server portability
2, 4 (b) --frozen with gate-parked and approved servers ::test_frozen_applies_the_executables_gate_like_install; test_portable_mcp_approval_reqs.py::test_frozen_install_reaches_the_install_verdict reproducibility
4, 5 (c, d) audit passes; a changed definition is parked, then re-approved ::test_changed_definition_is_parked_until_reapproved supply-chain safety
9 (e) lockfile-only edit ::test_lockfile_only_edit_cannot_grant_trust; ::test_lockfile_state_never_grants_transitive_consent evidence never consent
10, 11 (f) org deny beats an approval ::test_org_policy_beats_an_approval; unit test_row11_*, test_org_deny_beats_a_pinned_registry_overlay_and_the_flag governance
6 (g) one-off warns and does not persist ::test_one_off_flag_warns_and_does_not_persist explicit consent
15, 16 hook pin and legacy true warning ::test_pinned_hook_file_is_parked_when_its_script_changes, ::test_legacy_type_approval_warns_with_the_pin_remedy supply-chain safety
native superpowers-shaped plugin (dispatcher, sibling script, Cursor variant) admitted after approve; a byte change and a mode change each park it with the re-approve message; re-approve restores it ::test_native_plugin_is_approved_by_one_pin_over_its_whole_root supply-chain safety
native per-file hook pins never register a native plugin; legacy hooks: true registers and warns ::test_native_plugin_per_file_hook_pins_never_register_it, ::test_native_plugin_legacy_hook_grant_registers_and_warns one unit
seam every verdict of admit_native_plugin, including mode change, added file, deny over a matching pin, a prompt-only pinned plugin, .apm/ references, normalization output ignored, and the plugin hash equal to the deployed bundle hash; a plugin pin never admits a split install test_trust_admission.py::test_native_plugin_seam_*, ::test_record_pins_adds_one_plugin_item_beside_split_item_pins, ::test_plugin_pin_never_admits_a_split_install, ::test_native_plugin_referencing_apm_owned_paths_is_parked, ::test_native_plugin_hash_equals_bundle_hash_of_the_deployed_file_set, ::test_plugin_grant_must_be_a_full_fingerprint_under_allow single owner
D1 first approval lists the packages it parks ::test_first_project_approval_warns_about_packages_it_parks no surprise
D4, 14 --user pin admits locally, audit ignores it ::test_user_approval_admits_locally_but_audit_ignores_it portability
D9 unpinnable registry overlay exits 1, nothing written ::test_approve_refusal_exits_nonzero_and_writes_nothing honest exit codes
19 uninstalling a sibling keeps a survivor's pinned hooks ::test_uninstalling_a_sibling_keeps_a_survivors_pinned_hooks no over-delete
explain, update policy explain reports a pinned approval as allowed; apm update deploys pinned hooks test_executable_approval_default_host_lifecycle.py, test_executable_approval_replacement_lifecycle.py, test_hook_nested_metadata_install.py one owner
1-8, 14, 23, 25 ladder, user layer, identity, registry pinning offline (D9), tampered install tests/unit/security/test_trust_admission.py (31), test_trust_fingerprint.py (14) single owner

Every lifecycle case fails on 0.36: apm approve wrote no pins, --frozen failed gate-parked servers, and audit accepted one-off locks.

Commands and results
  • APM_E2E_TESTS=1 APM_BINARY_PATH=$PWD/.venv/bin/apm .venv/bin/python -m pytest tests/integration/test_mcp_portable_approval_lifecycle.py -p no:xdist -q: 14 passed
  • Approve-related integration set (test_hook_nested_metadata_install.py, test_executable_approval_replacement_lifecycle.py, test_executable_approval_default_host_lifecycle.py, test_hook_path_package_lifecycle.py, test_local_bundle_hooks_lifecycle.py, test_manifest_rewrite_preservation_lifecycle.py, test_install_lsp_lockfile_determinism.py, test_lifecycle_workspace_lock.py, test_manifest_duplicate_key_lifecycle.py): 65 passed
  • ... tests/integration/test_mcp_deliberate_omission_audit_lifecycle.py tests/integration/test_mcp_omission_lifecycle.py: 10 passed
  • .venv/bin/python -m pytest -p no:xdist -q tests/unit/install tests/unit/integration tests/unit/security tests/unit/commands tests/unit/policy tests/unit/copilot_plugins tests/unit/test_surviving_deps_reintegration.py tests/spec_conformance: 10018 passed, 2 load-timeouts in test_install_safety.py that pass on rerun (42 passed)
  • Architecture: test_architecture_owner_rule_mutations.py (new and touched guards), test_architecture_runner.py, test_architecture_mcp_omissions.py, test_architecture_install_compound_mutations.py -k audit: all passed
  • Lint mirror: uvx [email protected] check / format --check, pylint R0801, scripts/lint-auth-signals.sh, scripts/lint_architecture_boundaries.py --root .: clean

How to test

  • In a project with ./pkgs/parent -> ../leaf, where leaf declares a self-defined MCP server, run apm install. The server is parked and the warning reads Approve for everyone: apm approve local:pkgs/leaf.
  • Run apm approve local:pkgs/leaf. It lists the command, and apm.yml gains mcp: {leaf-server: sha256:...}.
  • Run apm install. The server deploys, and apm install --frozen and apm audit --ci pass.
  • Change the leaf server's args, then run apm install. The server is parked with definition changed since approval; re-approve to restore it.
  • Run apm install --trust-transitive-mcp without an approval. The run warns for this run only, and apm audit --ci then fails consent.

Changelog

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md gains the new req-sc-016 anchor and prose, an extended req-sc-011, and an Appendix C row (amendment 0.1.64, proposed).
  • Manifest edit: docs/public/specs/manifests/openapm-v0.1.requirements.yml.
  • Test edit: tests/spec_conformance/test_portable_mcp_approval_reqs.py (req-sc-016, req-sc-011).
  • CONFORMANCE.{md,json} regenerated via python -m tests.spec_conformance.gen_statement.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Co-authored-by: Copilot [email protected]

Copilot AI balanced review requested due to automatic review settings November 19, 2026 11:24
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 19, 2026
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: needs_rework

The PR turns boolean approvals into SHA-256 content pins that travel with the repo. At head 6c153b3 the panel found two blocking defects: an org deny can be bypassed for native plugin hooks, and policy explain no longer reports pinned approvals as allowed.

panel-mode=lean; personas=python-architect,supply-chain-security-expert,devx-ux-expert,test-coverage-expert,apm-ceo

cc Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The direction is right. Today, apm approve stores a boolean that keeps approving a dependency after its content changes. #3902 replaces it with a pin of the exact approved content, which one owner, admit(), enforces for teammates and CI alike. The scope record is respected. D7 and D10 stayed out, and the captain's native-hook addition goes through admit().

Two panelists found real holes at this head, both on the PR's core promise:

  • Org deny bypass. native_hook_approval ignores the package-level hooks verdict. A native plugin with a pinned hooks: {} map and no hook JSON therefore registers even under an org deny.
  • policy explain regression. apm policy explain and marketplace doctor never consult the trust owner, so a fresh pinned approval shows as blocked (default-deny). On main, explain reported the same approval as allowed.

Two integration tests also still assert the old hooks: true write shape and are likely red. All three fixes are bounded and inside the declared scope.

Dissent. The panelists did not disagree on severity. The CEO asks to fold two recommended items in this PR because both undermine content pinning:

  • the --trust-transitive-mcp override on exec-gated servers;
  • the subject-enumerator divergence.

Aligned with:

  • portable-by-manifest: a strong upgrade.
  • secure-by-default: the intent is right, but the native deny path and the one-off override need narrowing.
  • governed-by-policy: audit must say when the org policy is unavailable, and explain must read the same owner.
  • pragmatic-as-npm: approve exit codes must reflect whether anything was written.
  • community: teams on mixed APM versions need a hint.

Panel summary

Persona B R N Takeaway
Python Architect 1 2 0 trust.py is the right owner, but some readers bypass it: explain and doctor ignore pins, and three MCP subject enumerators exist.
Supply Chain Security 1 2 0 The ladder is sound, but native hooks let a pin override a deny. Also review the one-off override and audit on a cold policy cache.
DevX UX 0 3 0 The pin shape and wording are clean. Fix the native-plugin docs line, approve exit codes and message order, and the 0.37 hint.
Test Coverage 0 3 0 The 11 real-binary tests cover most promises. Two integration tests still assert the old shape, and the uninstall-survivor and --user/audit paths have no trap.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Supply Chain Security] (blocking-severity)
    • Fix: native_hook_approval returns hooks_approved and verdict.allowed, and deny short-circuits in native_hooks_admission and hook_file_filter. Add a test with org deny, hooks: {} and no hook JSON.
    • Why: today the deny does not hold.
  2. [Python Architect] (blocking-severity)
    • Fix: add one package_type_verdicts() owner for explain, doctor, --list/--pending, exec_gate and native status, and extend G1.
    • Why: a pinned approval currently shows as blocked.
  3. [Test Coverage]
    • Fix: update the two stale integration tests to the pin shape and rerun them.
    • Why: they become traps for update-with-pins and replacement-pins.
  4. [Supply Chain Security]
    • Fix: limit the one-off --trust-transitive-mcp override to overlays that are not exec-gated.
    • Why: a stale pin must never admit arbitrary content for a self-defined server.
  5. [Supply Chain Security]
    • Fix: when the policy cache misses during the audit consent check, report "org policy unavailable", and narrow the bare except.
    • Why: on a cold CI runner, org deny silently disappears.

Recommendation

Do not merge head 6c153b3. The direction is right and the rework is bounded:

  1. Fold the native-hook org-deny bypass with its test.
  2. Route explain and doctor through a single package_type_verdicts() owner covered by G1.
  3. Update the two stale integration tests and rerun them.
  4. Fold the cheap in-scope recommendations:
    • narrow the one-off override;
    • add the policy-unavailable audit message;
    • use a single MCP subject enumerator;
    • make approve exit codes honest;
    • add the version hint and the docs fix.

After that, this is a minor release that ships with follow-ups. Only the McpAdmission construction cleanup needs tracking.


Full per-persona findings

Python Architect

  • [blocking] apm policy explain and marketplace doctor never call the trust owner, so a pinned hooks or mcp approval shows as blocked by default-deny. Location: src/apm_cli/commands/approve.py:304.
    Suggested: add package_type_verdicts() in trust.py and route every per-type verdict reader through it. Extend G1, and add a lifecycle test showing explain reports allowed after approve.
  • [recommended] The three MCP subject enumerators diverge. A pinned transitive overlay whose registry entry changed is parked by install, while pinned_exec_status reports it as deployed. Location: src/apm_cli/security/trust.py:488.
    Suggested: use one enumerator for admission, status and pins.
  • [recommended] McpAdmission is built four different ways, and for_project duplicates policy discovery and swallows exceptions. Location: src/apm_cli/security/trust.py:270.
    Suggested: delegate to one policy owner and warn on fallback.

Supply Chain Security

  • [blocking] native_hook_approval ignores the package-level hooks verdict, so an org deny is bypassed when a package has a pinned map but no hook JSON files. Location: src/apm_cli/install/native_plugin_admission.py:259.
    Suggested: return hooks_approved and verdict.allowed, short-circuit deny, and add a test.
  • [recommended] A one-off run turns a stale pin into an any-content approval for exec-gated servers. Location: src/apm_cli/security/trust.py:188.
  • [recommended] The audit consent check uses cache-only policy and maps a cache miss, or any exception, to "no policy". Location: src/apm_cli/security/trust.py:284.

DevX UX

  • [recommended] approve.md says per-file pins do not admit a native plugin, but the code does admit it. Location: docs/src/content/docs/reference/cli/approve.md:117.
  • [recommended] apm approve prints [+] Approved before the confirm prompt, and exits 0 when it refuses or the user declines. Location: src/apm_cli/commands/approve.py:618.
  • [recommended] On mixed-version teams, pins break teammates still on 0.36 with an opaque type error. Add a one-line hint when the first pins are written.

Test Coverage

  • [recommended] Two unchanged integration tests still assert the old approve write shape: tests/integration/test_hook_nested_metadata_install.py:81 and test_executable_approval_replacement_lifecycle.py:135.
  • [recommended] No lifecycle trap proves that uninstalling a sibling package keeps a survivor's pinned hooks. Location: src/apm_cli/integration/hook_reintegration.py:71.
  • [recommended] D4 is tested only at the builder level. Add a lifecycle case that runs approve --user, install and audit --ci.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Existing MCP approval pins can be bypassed by switching to a custom registry, and item-level approvals can break native-plugin registration.

6 open issues
What changed in this PR

This PR adds portable, content-pinned approval for dependency MCP servers and hook files. It centralizes admission decisions across installation, frozen replay, audit, and approval commands, extending the earlier MCP omission-evidence work.

Changes:

  • Records per-item SHA-256 approvals in apm.yml, with changed definitions withheld pending review.
  • Aligns MCP consent checks and adds per-file hook admission for deployment and native plugins.
  • Adds lifecycle tests, architecture guards, documentation, and proposed OpenAPM conformance requirements.
File Description
tests/​unit/​security/​test_trust_fingerprint.py Tests fingerprint stability and content binding.
tests/​unit/​security/​test_trust_admission.py Tests admission precedence, pins, and native hooks.
tests/​unit/​security/​test_executables.py Removes tests for the retired MCP filter.
tests/​unit/​security/​test_exec_vocab_unification.py Uses the shared project approval-map reader.
tests/​unit/​scripts/​test_architecture_runner.py Registers the three new guard identifiers.
tests/​unit/​policy/​test_ci_checks.py Expects audit to re-evaluate consent.
tests/​unit/​integration/​test_mcp_config_view.py Migrates MCP view tests to admission objects.
tests/​unit/​integration/​test_frozen_mcp_evidence.py Updates frozen-validation admission inputs.
tests/​unit/​install/​test_mcp_only_lockfile_creation.py Updates MCP-only view construction.
tests/​unit/​install/​test_local_single_file_materialization.py Updates local-source admission inputs.
tests/​unit/​commands/​test_approve_deny.py Expects version-independent approval keys.
tests/​spec_conformance/​test_portable_mcp_approval_reqs.py Adds portable-consent and frozen-install conformance tests.
tests/​spec_conformance/​test_mcp_omission_inventory.py Updates omission tests to use admission objects.
tests/​spec_conformance/​test_lockfile_reqs.py Updates frozen lockfile test setup.
tests/​integration/​test_mcp_portable_approval_lifecycle.py Adds end-to-end approval and revocation scenarios.
tests/​integration/​test_mcp_omission_lifecycle.py Uses persistent approvals for retained MCP baselines.
tests/​integration/​test_mcp_deliberate_omission_audit_lifecycle.py Expects one-off consent to fail audit.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds mutation cases for trust guards.
tests/​integration/​test_architecture_mcp_omissions.py Updates admission-routing mutations.
tests/​integration/​test_architecture_install_compound_mutations.py Updates audit mutation anchors.
src/​apm_cli/​utils/​yaml_io.py Increases output width for fingerprint scalars.
src/​apm_cli/​security/​trust_fingerprint.py Centralizes approval and evidence hashing.
src/​apm_cli/​policy/​ci_checks.py Re-evaluates project consent during audit.
src/​apm_cli/​integration/​mcp_config_view.py Applies admission and records consent failures.
src/​apm_cli/​integration/​hook_reintegration.py Filters surviving hooks by item approval.
src/​apm_cli/​install/​services.py Passes approval context to native-plugin admission.
src/​apm_cli/​install/​service.py Applies shared admission during frozen validation.
src/​apm_cli/​install/​phases/​integrate.py Supplies trust context during hydrated replay.
src/​apm_cli/​install/​native_plugin_admission.py Checks native hook pins and updates gated status.
src/​apm_cli/​install/​mcp/​integration.py Uses shared admission and warns about one-off trust.
src/​apm_cli/​install/​exec_gate.py Connects hook pins and item-level status checks.
src/​apm_cli/​install/​deployment_plan.py Applies hook admission before deployment planning.
src/​apm_cli/​install/​deployable_source_plan.py Selects only admitted hook sources.
src/​apm_cli/​commands/​uninstall/​engine.py Uses permissive discovery for managed-server cleanup.
src/​apm_cli/​commands/​approve.py Records pins, displays definitions, and reports pending approvals.
scripts/​architecture_linter/​checks/​mutation_mcp_target_and_scope.py Updates omission-owner routing checks.
scripts/​architecture_linter/​checks/​install_portable_trust.py Adds admission and fingerprint ownership guards.
scripts/​architecture_linter/​checks/​install_lsp_plugin.py Updates executable-trust routing expectations.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Registers portable-trust rules.
packages/​apm-guide/​.apm/​skills/​apm-usage/​governance.md Documents pin storage and precedence.
packages/​apm-guide/​.apm/​skills/​apm-usage/​dependencies.md Explains portable transitive MCP consent.
docs/​src/​content/​docs/​specs/​openapm-v0.1.md Proposes portable-consent and frozen-parity requirements.
docs/​src/​content/​docs/​reference/​manifest-schema.md Describes item-level executable grants.
docs/​src/​content/​docs/​reference/​lockfile-spec.md Documents new omission reasons and consent checks.
docs/​src/​content/​docs/​reference/​cli/​update.md Clarifies one-off trust behavior.
docs/​src/​content/​docs/​reference/​cli/​install.md Documents pinned approval and frozen validation.
docs/​src/​content/​docs/​reference/​cli/​approve.md Documents pinning, output, storage, and migration.
docs/​src/​content/​docs/​reference/​baseline-checks.md Explains audit consent and omission reconciliation.
docs/​src/​content/​docs/​producer/​author-primitives/​mcp-as-primitive.md Explains approval implications for producers.
docs/​src/​content/​docs/​enterprise/​security.md Describes content binding and its limits.
docs/​src/​content/​docs/​enterprise/​policy-reference.md Removes obsolete trust-message example output.
docs/​src/​content/​docs/​enterprise/​governance-guide.md Updates consent controls and policy guarantees.
docs/​src/​content/​docs/​enterprise/​apm-policy.md Clarifies transitive consent versus policy settings.
docs/​src/​content/​docs/​consumer/​install-packages.md Adds portable approval guidance.
docs/​src/​content/​docs/​concepts/​primitives-and-targets.md Updates MCP approval terminology.
docs/​src/​content/​docs/​concepts/​lifecycle.md Updates transitive MCP troubleshooting guidance.
docs/​src/​content/​docs/​concepts/​glossary.md Updates the MCP consent definition.
docs/​public/​specs/​manifests/​openapm-v0.1.requirements.yml Adds req-sc-016 to the requirements inventory.
CONFORMANCE.md Updates requirement coverage and counts.
CONFORMANCE.json Records machine-readable conformance coverage.
CHANGELOG.md Adds feature, compatibility, and upgrade notes.
.apm/​architecture/​owners/​install-deployment.json Registers item-admission and fingerprint owners.

Review effort: Balanced

Comment thread src/apm_cli/commands/approve.py Resolved
Comment thread src/apm_cli/commands/approve.py Resolved
Comment thread src/apm_cli/commands/approve.py Resolved
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-portable-mcp-approval branch from 6c153b3 to db5b4e4 Compare November 19, 2026 14:31
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
- Native plugins: an org/project deny wins before any hook file is read,
  and per-file pins only narrow the package verdict (no empty-pin bypass).
- One per-type verdict reader, trust.package_type_verdicts, now backs
  apm policy explain, approve --list/--pending, doctor, lockfile
  exec_status and native status; G1 forbids pin-blind resolvers outside
  security/.
- One MCP enumerator feeds install, status and pins, so a changed pinned
  registry overlay reads as not deployed everywhere.
- --trust-transitive-mcp never re-approves a changed self-defined server.
- apm audit --ci discovers org policy like install (honoring --no-policy)
  and names an unavailable policy instead of passing silently.
- apm approve prints success after the write, exits 1 on a refused pin or
  declined prompt, and hints the APM 0.37 requirement on the first pin.
- Stale integration tests moved to the pinned shape; new lifecycle traps
  for --user vs audit, refusal exit code and uninstall survivors.

Refs #3902 (req-sc-016, req-sc-011)

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-portable-mcp-approval branch from db5b4e4 to 1c714d9 Compare November 19, 2026 15:27
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
- Native plugins: an org/project deny wins before any hook file is read,
  and per-file pins only narrow the package verdict (no empty-pin bypass).
- One per-type verdict reader, trust.package_type_verdicts, now backs
  apm policy explain, approve --list/--pending, doctor, lockfile
  exec_status and native status; G1 forbids pin-blind resolvers outside
  security/.
- One MCP enumerator feeds install, status and pins, so a changed pinned
  registry overlay reads as not deployed everywhere.
- --trust-transitive-mcp never re-approves a changed self-defined server.
- apm audit --ci discovers org policy like install (honoring --no-policy)
  and names an unavailable policy instead of passing silently.
- apm approve prints success after the write, exits 1 on a refused pin or
  declined prompt, and hints the APM 0.37 requirement on the first pin.
- Stale integration tests moved to the pinned shape; new lifecycle traps
  for --user vs audit, refusal exit code and uninstall survivors.

Refs #3902 (req-sc-016, req-sc-011)

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-portable-mcp-approval branch from 1c714d9 to d2c0eed Compare November 19, 2026 16:19
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
- Native plugins: an org/project deny wins before any hook file is read,
  and per-file pins only narrow the package verdict (no empty-pin bypass).
- One per-type verdict reader, trust.package_type_verdicts, now backs
  apm policy explain, approve --list/--pending, doctor, lockfile
  exec_status and native status; G1 forbids pin-blind resolvers outside
  security/.
- One MCP enumerator feeds install, status and pins, so a changed pinned
  registry overlay reads as not deployed everywhere.
- --trust-transitive-mcp never re-approves a changed self-defined server.
- apm audit --ci discovers org policy like install (honoring --no-policy)
  and names an unavailable policy instead of passing silently.
- apm approve prints success after the write, exits 1 on a refused pin or
  declined prompt, and hints the APM 0.37 requirement on the first pin.
- Stale integration tests moved to the pinned shape; new lifecycle traps
  for --user vs audit, refusal exit code and uninstall survivors.

Refs #3902 (req-sc-016, req-sc-011)

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Spec Guardian: fold_and_ship

Scope: editorial-patch; diff = +71/-9 lines across 2 file(s). Shocked-meter avg: 7.25/10 (post-fold estimate; round-1 measured avg 6.25).

Round-1 panel scores were 6, 6, 7 and 6 (average 6.25). The panels raised 7 blocking findings, which group into 3 themes:

  • T1: the definition fingerprint is undefined.
  • T2: a per-user pin admits a server, which the (b) text does not allow.
  • T3: the one-off opt-in admits a changed overlay.

The synthesizer checked each fold against the working tree. Every blocker is closed:

  • req-sc-016 now defines a full-length sha256 fingerprint that is never matched by prefix. It is taken from the installed source and covers every field that determines what runs, plus the resolved registry entry. A digest the consumer does not recognize does not match.
  • (b) names both the consuming manifest and the req-sc-010 per-user location, and the manifest decides when both bind. A dependency's own manifest never grants.
  • "even under (c)" is now normative. trust.admit no longer lets the one-off override a pin, and its unit test, a new conformance test and approve.md match.

A real-binary probe confirmed that a lockfile depth edit cannot make a transitive server direct: audit fails, a frozen install fails closed, and plain install re-resolves depth. That supports deferring T6. It is now a lifecycle test.

The 7.25 average in the table is the synthesizer's post-fold estimate, not a re-spawned panel score. If you prefer measured scores, the honest fallback is the round-1 average of 6.25, which would mean needs_revision.

All three fold-now items below were applied in d2c0eed8fa.

Convergence

Panel Verdict Shocked New B New R New N
Swagger / OpenAPI editor ship_with_followups 7/10 0 2 0
OCI distribution editor ship_with_followups 7/10 0 4 0
Package-manager registry-contract editor ship_with_followups 8/10 0 5 0
Web-platform architect ship_with_followups 7/10 0 2 0

B = new blocking findings, R = new recommended, N = new nits. These are post-fold estimates. In round 1 the panels found 2, 1, 1 and 3 blockers, all now closed by folds.
Counts are signal strength, not gates. The maintainer ships.

Convergent themes (flagged by 2+ panels)

  • T1 -- The definition fingerprint was undefined: algorithm, length, prefix matching, field coverage, registry entry, source vs lockfile, unrecognized digests. Closed by fold; the byte-level canonical construction is deferred. (supporting: oci-blk-r1-1, pkg-blk-r1-1, tag-blk-r1-3, oci-rec-r1-1)
  • T2 -- Where consent lives (manifest vs per-user req-sc-010 pins) and how it relates to req-sc-010. Closed by fold. (supporting: tag-blk-r1-1, sw-blk-r1-2, oci-rec-r1-6, tag-rec-r1-2, sw-rec-r1-5)
  • T3 -- The one-off opt-in admitted a stale-pinned registry overlay. Closed by a spec fold plus a code change. (supporting: tag-blk-r1-2, sw-blk-r1-1, oci-rec-r1-5)
  • T4 -- The grant has no normative manifest key or schema. Deferred, with an honesty disclosure folded now. (supporting: oci-rec-r1-2, pkg-rec-r1-1, tag-rec-r1-1, sw-rec-r1-2)
  • T5 -- Scope terms, (a) semantics, and org denial over every path. Closed by fold. (supporting: oci-rec-r1-4, sw-rec-r1-4, tag-nit-r1-4, pkg-rec-r1-4, tag-rec-r1-4, pkg-rec-r1-5, sw-rec-r1-1, tag-rec-r1-3)
  • T6 -- Lifecycle and identity: transitive status from lock depth, retracting stale entries, frozen outcome for an opted-in server, visibility. Deferred to v0.1.1. (supporting: oci-rec-r1-3, pkg-rec-r1-3, oci-rec-r1-7, pkg-rec-r1-2, tag-rec-r1-5)

Fold now (3 item(s), all applied)

  1. [F1 / T5] sec.10.13 req-sc-016 clause (a) -- Under (a), the consumer deploys the consuming manifest's declaration, and a grant bound to the dependency's declaration does not apply.
    Success criterion: the clause text is present exactly once; pinned test anchors still match; the MUST count is unchanged
  2. [F2 / T4] sec.10.13 paragraph after req-sc-016 -- A non-normative disclosure that the grant's manifest key and the byte construction of the fingerprint input are implementation-defined at this revision.
    Success criterion: the sentence contains no RFC 2119 keyword; totals stay at 148 (143 MUST, 5 SHOULD)
  3. [F3 / T6] conformance coverage -- The depth-tamper probe became the asserting lifecycle test test_lockfile_depth_edit_cannot_make_a_transitive_server_direct.
    Success criterion: no probe file is committed; the test passes with APM_BINARY_PATH=.venv/bin/apm
Defer to v0.1.1 (6 items)
  • [F4 / T1] req-sc-016 fingerprint -- Specify the canonical byte construction of the fingerprint input, with a shared oracle fixture.
  • [F5 / T4] req-sc-016 (b); manifest schema -- A normative manifest key and schema for the grant, reconciled with req-sc-009 allowExecutables.
  • [F6 / T6] req-sc-016 transitive definition -- Derive direct versus transitive status from the consuming manifest (after replace:) instead of lock depth. Today audit's no-orphaned-packages check and a fail-closed frozen install mitigate it.
  • [F7 / T6] req-sc-016, req-sc-011 -- Define four behaviors: retracting a stale written entry, the frozen outcome for a past opt-in, visibility of opted-in servers, and the role of mcp.trust_transitive / mcp.self_defined once enforced.
  • [F8] conformance coverage -- Add two tests: a byte-identical persist-nothing check after an opt-in run, and (a) re-declaration with a stale grant present.
  • [F9] editorial -- "MUST NOT admit ... unless" phrasing; a req-sc-007 redaction cross-reference; split manifest sub-claims; an oracle fixture; a Section 10.12 half-sentence.

Linter handoff:

  • All 11 checks pass at d2c0eed8fa: ASCII-only, no forbidden tokens, unique anchors, and consistent counts at 148 (143 MUST, 5 SHOULD) across sec.1.3, Appendix C and Appendix D.
  • Links resolve. There are no mermaid blocks, and no schema or fixture changes.
  • The CHANGELOG mentions openapm. orphan_check is aligned at 148.
  • Check 11 notes that .py files changed. The code is reviewed separately by the autopilot-pr-review-worker panel (advisory comment above).

Full per-panel findings (round 1, condensed)

Swagger / OpenAPI editor -- shocked_meter 6/10, confidence high

Summary: The bookkeeping is clean. req-sc-016 lists exactly three consent routes, but the reference implementation contradicted it twice: a one-off opt-in overrode a stale pin, and a user-local pin admitted a server.

  • [sw-blk-r1-1] The opt-in versus stale-pin MUST NOT conflict. Folded; the code was changed.
  • [sw-blk-r1-2] The per-user pin was outside (b). Folded.
  • [sw-rec-r1-1..6] Org denial scope; whose manifest; fingerprint definition; scope terms; the req-sc-010 relation; test gaps. Folded, except F8 (deferred).
  • Nits: default-visible diagnostic, re-wrap, row 26, count note, sub-claims. Folded, except the sub-claims (F9).

OCI distribution editor -- shocked_meter 6/10, confidence high

Summary: The shape is right: deny wins, consent never comes from the lockfile, and a changed definition fails closed. But the trust anchor, the fingerprint, had no normative algorithm, envelope, coverage or registry binding.

  • [oci-blk-r1-1] The fingerprint was undefined. Folded.
  • [oci-rec-r1-1..7] Canonical construction (F4), schema key (F5), transitive from depth (F6), scope terms (folded), opt-in precedence (folded), user-local pins (folded), retracting stale entries (F7).
  • Nits: redaction (F9), Threat sentence (folded), row 26 (folded), re-wrap (folded), oracle fixture (F9), Section 10.12 (F9).

Package-manager registry-contract editor -- shocked_meter 7/10, confidence high

Summary: The three admission paths have the right shape and keep consent independent of the lockfile. The fingerprint construction and coverage, frozen and opt-in lock behavior, transitive-from-depth, and the grant's manifest home needed pinning.

  • [pkg-blk-r1-1] The fingerprint was undefined. Folded.
  • [pkg-rec-r1-1..6] Grant home and req-sc-009/010 (req-sc-010 relation folded; key deferred to F5), frozen outcome (F7), depth (F6), (a) semantics (folded), mcp.* policy role (org denial folded; the trust_transitive role is in F7), tests (partly folded; F8).
  • Nits: MUST NOT phrasing (F9), Threat sentence (folded), re-wrap (folded).

Web-platform architect -- shocked_meter 6/10, confidence high

Summary: The amendment is narrowly scoped and its counts are consistent, but the normative text diverged from the reference ladder (user pins, opt-in override) and left the fingerprint undefined.

  • [tag-blk-r1-1] Per-user pins. Folded.
  • [tag-blk-r1-2] Opt-in override. Folded; the code was changed.
  • [tag-blk-r1-3] Fingerprint undefined. Folded.
  • [tag-rec-r1-1..7] Grant syntax (F5 plus disclosure), the req-sc-010 relation (folded), org denial over all paths (folded), (a) semantics (folded), diagnostics and frozen edge (default-visible folded; frozen in F7), Appendix D changed-outcome class and migration (folded), MCP-only scope note (folded).
  • Nits: "proposed" manifest prefix (folded), Threat sentence (folded), re-wrap (folded), scope terms (folded).

This panel is advisory. It does not block merge. Re-apply the spec-review label after addressing feedback to re-run.


Generated by apm-spec-guardian. This comment is AI-generated and may contain errors.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
- an existing MCP pin is checked even when the new declaration would
  not need approval (self-defined -> registry no longer bypasses it);
  the pin probe is policy-free, so no extra org policy discovery
- the admission subject fingerprints the authored declaration, as
  apm approve pins it
- apm approve --list/--pending report a transitive server that a
  legacy mcp: true leaves parked, matching install (D2)

Refs req-sc-016.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-portable-mcp-approval branch from db1ca1d to 6c341b7 Compare November 19, 2026 17:02
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
- Native plugins: an org/project deny wins before any hook file is read,
  and per-file pins only narrow the package verdict (no empty-pin bypass).
- One per-type verdict reader, trust.package_type_verdicts, now backs
  apm policy explain, approve --list/--pending, doctor, lockfile
  exec_status and native status; G1 forbids pin-blind resolvers outside
  security/.
- One MCP enumerator feeds install, status and pins, so a changed pinned
  registry overlay reads as not deployed everywhere.
- --trust-transitive-mcp never re-approves a changed self-defined server.
- apm audit --ci discovers org policy like install (honoring --no-policy)
  and names an unavailable policy instead of passing silently.
- apm approve prints success after the write, exits 1 on a refused pin or
  declined prompt, and hints the APM 0.37 requirement on the first pin.
- Stale integration tests moved to the pinned shape; new lifecycle traps
  for --user vs audit, refusal exit code and uninstall survivors.

Refs #3902 (req-sc-016, req-sc-011)

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
- an existing MCP pin is checked even when the new declaration would
  not need approval (self-defined -> registry no longer bypasses it);
  the pin probe is policy-free, so no extra org policy discovery
- the admission subject fingerprints the authored declaration, as
  apm approve pins it
- apm approve --list/--pending report a transitive server that a
  legacy mcp: true leaves parked, matching install (D2)

Refs req-sc-016.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Portable, content-pinned approval for dependency executables. A native plugin is admitted by one pin over its whole root, and any change to its bytes, file modes or .apm/ content parks it. All delta blockers are folded at 6c341b7.

panel-mode=delta; personas=python-architect,supply-chain-security-expert,devx-ux-expert,test-coverage-expert,apm-ceo

The delta panel raised two blockers. Both are fixed in the trust owner itself.

  • Native admission had two owners. The python-architect found that admit_native_plugin decided only when a pin existed, so the install path and the listing could disagree.
    • Every native install, pinned or not, now goes through _native_approval -> admit_native_plugin, using one type set (native_plugin_exec_types(extra)).
    • The hook overrides in the callers are gone.
    • Guard tokens lock the call site. The regression test is test_unpinned_native_install_follows_the_owner.
  • The .apm/ check was a heuristic. The supply-chain expert found that scanning for .apm/ references could be bypassed. It is now a rule: every file under the root .apm/ must be a byte copy of a pinned plugin file, with no symlinks, or the plugin parks as apm-owned-reference (utils/content_hash.unpinned_apm_copy).
    • This fails closed for obfuscated, binary and one-hop references.
    • Tests cover a new file, a changed copy and a symlink, with an obfuscated script present.

The recommended findings are folded, each with a test:

  • D2 now covers transitive native plugins (keyword-only transitive=).
  • A malformed pin store falls back to the full context, which reports it.
  • apm approve exits 1 on apm-owned-reference, and --pending says "cannot be approved".
  • Denied items point to apm policy explain.
  • The listing shows the item pins recorded for split installs.
  • Three new lifecycle traps:
    • a pinned server rewritten as a registry reference parks;
    • --pending reports a legacy transitive mcp: true;
    • real per-file pins never register a native plugin.

Evidence at head:

  • The lint mirror is clean, and the guard mutation tests pass (116).
  • Real-binary lifecycle tests pass: 149, plus 4 new.
  • The spec guardian returned fold_and_ship with 0 open blockers.
  • All 6 Copilot inline threads are resolved.
  • The D6 breaking change has a CHANGELOG entry with its migration (apm approve <pkg>, then commit apm.yml).

Aligned with:

  • Portable by manifest: consent is a content-addressed pin in apm.yml.
  • Secure by default: drift, symlinks and .apm/ files that are not copies all park, and mcp: true never grants transitive trust.
  • Governed by policy: denials point to apm policy explain, and audit --ci enforces consent.
  • Multi-harness: one pin type covers Copilot Agent Plugins and Codex bundles, while split installs keep per-hook-file pins.
  • Pragmatic: one approve command, and an unapprovable state exits 1 with the reason.

Panel summary

Persona B R N Takeaway
Python architect 1 2 0 MCP routing and _has_pin are sound. Native admission had two owners (now folded).
Supply-chain security expert 1 2 0 The .apm/ exclusion was a heuristic (now a structural byte-copy rule). D2 and the pin-store fallback are folded.
DevX UX expert 0 3 0 The approve and parked messages now lead to an action that works. Docs show what is stored.
Test coverage expert 0 3 0 Three real-binary traps were added for the delta behaviors.

Recommended follow-ups

These are deferred per the binding record; no issues filed.

  1. Org-level mcp.trust_transitive enforcement. It gives a governed org-wide lever without reopening transitive trust.
  2. D7: apm approve -g for user-scope installs.
  3. D10: park a package on a name conflict.
  4. Spec findings F4-F9 into req-sc-016 for OpenAPM v0.1.1 (see the spec guardian comment).

Ship now

Merge at 6c341b7 once CI is green.

Folded findings (delta)
  • python-architect:
    • B: single native owner.
    • R: one type set.
    • R: guard tokens.
  • supply-chain-security-expert:
    • B: .apm/ byte-copy rule.
    • R: transitive native D2.
    • R: _has_pin fallback.
  • devx-ux-expert:
    • R: apm-owned-reference loop.
    • R: denied message.
    • R: listed split-install item pins plus docs.
  • test-coverage-expert:
    • R: registry rewrite lifecycle.
    • R: per-file native pins lifecycle.
    • R: legacy --pending lifecycle.

Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-portable-mcp-approval branch from 6c341b7 to 0bb0886 Compare November 19, 2026 17:29
…utables

Approvals in apm.yml executables.allow can pin each hook file and MCP
server to a full SHA-256 of what runs. One owner, security/trust.py
admit(), decides every dependency-declared executable item for install,
update, install --frozen, apm audit --ci, apm approve and the install
prompt; security/trust_fingerprint.py is the only hasher. The lockfile
stays evidence only (mcp_omissions reasons definition-changed, denied).

- apm approve lists what each package runs and records pins; a changed
  definition is parked with a re-approve message.
- --trust-transitive-mcp stays a one-off and says it does not persist.
- install --frozen applies the executables gate like install (#3893).
- audit --ci fails servers the lock admits but apm.yml does not approve.
- Native plugin hooks are admitted per hook file from the install dir.
- Legacy true approvals still deploy and warn.
- Guards: executable-item-admission, trust-fingerprint, mcp-admission.

Spec: OpenAPM v0.1 amendment 0.1.64 adds req-sc-016 and extends req-sc-011
to frozen install.

Refs #3902

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: changelog-only follow-up to the req-sc-016 amendment commit

Co-authored-by: Copilot App <[email protected]>
- Native plugins: an org/project deny wins before any hook file is read,
  and per-file pins only narrow the package verdict (no empty-pin bypass).
- One per-type verdict reader, trust.package_type_verdicts, now backs
  apm policy explain, approve --list/--pending, doctor, lockfile
  exec_status and native status; G1 forbids pin-blind resolvers outside
  security/.
- One MCP enumerator feeds install, status and pins, so a changed pinned
  registry overlay reads as not deployed everywhere.
- --trust-transitive-mcp never re-approves a changed self-defined server.
- apm audit --ci discovers org policy like install (honoring --no-policy)
  and names an unavailable policy instead of passing silently.
- apm approve prints success after the write, exits 1 on a refused pin or
  declined prompt, and hints the APM 0.37 requirement on the first pin.
- Stale integration tests moved to the pinned shape; new lifecycle traps
  for --user vs audit, refusal exit code and uninstall survivors.

Refs #3902 (req-sc-016, req-sc-011)

Co-authored-by: Copilot App <[email protected]>
A natively loaded plugin is approved as ONE item,
executables.allow.<pkg>.plugin: sha256:<64 hex>, over the native plugin
file set (path, exec bit, bytes; APM's root apm.yml and .apm/ excluded).
Any byte or mode change parks the plugin with the re-approve hint.
Per-file hook pins and the stray-file refusal leave the native path;
split installs keep per-hook-file pins (D3).

Seam for #3290: security.trust.admit_native_plugin(allow_executables,
package_keys, plugin_root) -> Admission, and
security.trust_fingerprint.native_plugin_fingerprint, delegating to
utils.content_hash.compute_native_plugin_hash.

Refs req-sc-016 (unchanged; MCP-only text).

Co-authored-by: Copilot App <[email protected]>
Fold the supply-chain review of the whole-root plugin pin:
- a plugin pin admits only a native install (admitted Copilot Agent
  Plugin or Codex bundle); a split install reads item pins, which
  apm approve now records beside the plugin pin;
- with a pin, deny and the content hash are checked even when no
  executable type is detected; the native type set is one owner
  (native_root_exec_types);
- decision A: an executable surface that references root .apm/ or
  apm.yml parks the plugin (apm-owned-reference) with one diagnostic
  naming the reference;
- the dev-dependency lifecycle persists consent with apm approve
  before audit --ci (D6).

Co-authored-by: Copilot App <[email protected]>
- define the definition fingerprint: full sha256, never by prefix,
  from installed source, covering every launch-affecting field plus the
  resolved registry entry; unrecognized means not matching
- (b) also admits a per-user req-sc-010 pin (manifest decides); a
  dependency's own manifest never grants
- a stale pin is withheld even under the opt-in; trust.admit no longer
  lets --trust-transitive-mcp override a changed overlay pin
- define the scope terms, (a) semantics, org denial over every path,
  the req-sc-010 relation and the MCP-only scope; disclose that the
  grant key and byte construction are implementation-defined
- lifecycle: a lockfile depth edit cannot make a transitive server direct

Refs req-sc-016, req-sc-011.

Co-authored-by: Copilot App <[email protected]>
CurrentMcpConfigView.select now takes McpAdmission instead of an
approve callable plus trust_transitive_self_defined; install, both
--frozen checks and audit admit through security/trust.py. Audit passes
exact=False (structural evidence) and still re-checks consent. The
omission-evidence rule pins the new routing; org deny-all records
reason 'denied'. Drop the duplicated frozen CHANGELOG line (#3938 owns
it).

Refs req-sc-011, req-sc-016.

Co-authored-by: Copilot App <[email protected]>
- an existing MCP pin is checked even when the new declaration would
  not need approval (self-defined -> registry no longer bypasses it);
  the pin probe is policy-free, so no extra org policy discovery
- the admission subject fingerprints the authored declaration, as
  apm approve pins it
- apm approve --list/--pending report a transitive server that a
  legacy mcp: true leaves parked, matching install (D2)

Refs req-sc-016.

Co-authored-by: Copilot App <[email protected]>
- every native install (pinned or not) is decided once by
  admit_native_plugin, over one type set (IR and manifest types passed
  as extra_types); the caller-side hook overrides are gone
- root .apm/ content that is not a byte copy of a pinned plugin file, or
  a symlink, parks the plugin (apm-owned-reference); approve refuses it
  with exit 1 and --pending says it cannot be approved
- a transitive native plugin with MCP needs the plugin pin (D2);
  admit_native_plugin gains keyword-only transitive and extra_types
- a malformed pin store falls back to the full context, which reports it
- denied items point at apm policy explain, not apm approve; the native
  listing says which split-install item pins it also records
- lifecycle: registry rewrite of a pinned server parks, legacy mcp: true
  shows in --pending, real per-file pins never register a native plugin

Refs req-sc-016.

Co-authored-by: Copilot App <[email protected]>
admit_native_plugin read a plain allowExecutables mapping without a
routed trust context as gate-off and admitted an unapproved Codex
bundle; build a gate-on context from the map so it fails closed
(req-sc-009, test_codex_consumer_denies_unapproved_manifest_referenced_mcp).

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit ee00d6a into main Nov 19, 2026
39 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-portable-mcp-approval branch November 19, 2026 18:07
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
…admit_native_plugin

- deployment_plan: Claude admission asks exec_gate.native_plugin_verdict, which
  calls security.trust.admit_native_plugin on the apm_modules source; parked
  plugins carry the trust owner's parked_plugin_message (req-na-005).
- Drop the local native hasher; import native_plugin_files and
  compute_native_plugin_hash from utils/content_hash (#3918's single owner).
- Fix: at user scope, install resolved executable trust from ~/apm.yml
  instead of ~/.apm/apm.yml, so pinned grants never applied to global
  installs; read the grants beside the manifest.
- Fix: unpinned_apm_copy refused every normalized legacy plugin because of
  the parser-owned .apm/.plugin-skill-sources.json receipt; exempt exactly it.
- apm approve treats a user-scope Claude-format plugin as native, so it
  writes the whole-plugin pin the native route checks (plus split item pins).
- Pending-approval entries for a parked Claude plugin are marked native.
- Lifecycle tests: park -> apm approve --all -> declared, with pinned grants.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
)

Windows has no POSIX exec bit, so chmod cannot change what the native
plugin pin hashes, and the two #3918 tests that re-gated a pin through
chmod failed on the Windows unit lane. The mode-change case is skipped on
Windows, and the normalization-output test re-gates through a publisher
byte change instead.

Fixes #3985

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
…ides for 0.37 (#3950)

* docs: reground consumer, producer, integration and troubleshooting guides for 0.37

Refs #3948. Wave 1 of the 0.37 docs sweep (docs-corpus-audit): guide
pages outside reference/, excluding pages owned by in-flight #3918
and #3290.

Co-authored-by: Copilot App <[email protected]>

* docs: tighten 0.37 frozen replay, origin and error quotes

Panel follow-ups on the 0.37 guides sweep: --frozen still reads the
marketplace for packages whose MCP/LSP servers come from the entry when
apm_modules is empty; the rebound-alias origin check fires on any
marketplace re-resolve, not only apm update; the dependency-confusion
refusal runs after the marketplace.json fetch and before any plugin
repository probe. Restore the remedy lines APM prints for the
newer-lockfile, --frozen selection and MCP conflict errors, use a
version pair that can actually produce the newer-lockfile refusal, and
split the ci-cd --frozen sentence so "never" does not carry to "exits 1".

Addresses CEO follow-ups FU-1..FU-4 (devx-ux-expert, doc-writer).

Co-authored-by: Copilot <[email protected]>

* docs: scope marketplace update, replay check and frozen upgrade

apm marketplace update refreshes caches only and keeps the ones that
refreshed when another fails, so it is described apart from the
apm update / --refresh "changes nothing" guarantee. Rows replayed from
apm.lock.yaml skip the dependency-confusion check, and the 0.37 --frozen
upgrade note now applies only when an older lock records a pairing that
differs from what 0.37 resolves.

Addresses Copilot inline on consumer/update-and-refresh.mdx:105,
troubleshooting/common-errors.md and troubleshooting/migration.md:183.

Co-authored-by: Copilot <[email protected]>

* docs: unify the --frozen MCP/LSP caveat and origin-conflict cause

The marketplace read under --frozen applies to any package that
contributes MCP or LSP servers whose copy under apm_modules/ is missing,
so one per-package sentence now carries it on all three pages. The
origin-conflict check only fires for an entry the lock already records,
so a brand-new entry is no longer listed as a trigger.

Addresses delta panel follow-ups (devx-ux-expert, doc-writer).

Co-authored-by: Copilot <[email protected]>

* docs: name the fresh-checkout MCP/LSP case for origin conflicts

A package that contributes MCP or LSP servers re-resolves through the
marketplace when its apm_modules copy is missing, so plain and --frozen
installs on a fresh checkout can also hit the origin-conflict check.
Mark the trigger list as examples and include that case.

Addresses terminal delta panel follow-up (devx-ux-expert).

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
* docs: reground pages freed by #3918 and leftover 0.37 drift

Refs #3948. Wave 2 of the 0.37 docs sweep (docs-corpus-audit): the
pages #3918 owned (concepts, install-packages, enterprise policy and
security, mcp-as-primitive, reference update/manifest-schema, apm-usage
dependencies/governance) plus reference/cli/deps.md (#3916 refusal).
Pages owned by in-flight #3290 are not touched.

Co-authored-by: Copilot App <[email protected]>

* docs(security): scope dependency-confusion and rebound claims to code

The new threat-model row credited #3895 with general dependency-confusion
protection, but it only catches one install graph declaring the same
owner/repo from two hosts; bare shorthand still resolves to the default
host. The rebound sentence also omitted lock rows without a recorded
origin, local marketplaces and in-repo moves, which the check skips.

Addresses supply-chain-security-expert panel findings and Copilot inline
on docs/src/content/docs/enterprise/security.md:323.

Co-authored-by: Copilot <[email protected]>

* docs(policy): fix skill CLI samples and allow-list wording

The apm-usage governance CLI samples used header and footer lines the
CLI never prints and a dry-run overflow that cannot follow two lines
(the preview limit is 5); align them with policy-reference. Section 3
still described a repo override in the discovered chain, and the
allowlist rows said 'non-empty', contradicting null vs [] semantics.

Addresses doc-writer and supply-chain-security-expert panel findings.

Co-authored-by: Copilot <[email protected]>

* docs(install): qualify marketplace replay and default_host wording

Locked marketplace entries replay offline except for a package whose
locked MCP or LSP servers have no apm_modules copy; that case reads the
marketplace even under --frozen (drift.py catalog-metadata). Also tie
default_host to the shorthand rather than #ref and link the newer
lockfile troubleshooting section.

Addresses Copilot inline on reference/manifest-schema.md:701 and
doc-writer panel nit on consumer/install-packages.md:64.

Co-authored-by: Copilot <[email protected]>

* test(docs): track host-qualified policy wording in security.md

security.md no longer says policy patterns are host-blind or cannot
restrict host identity: dependencies.allow/deny accept host-qualified
patterns (policy-reference). The docs-contract test still pinned the old
wording and failed Build & Test Shard 1. Keep its intent (no
transport-aware policy claim) and assert the scheme-blind sentence and
the host-qualified link instead.

Addresses CI failure in tests/unit/test_tls_docs_scope.py:127.

Co-authored-by: Copilot <[email protected]>

* docs(security): name the manifest whose default_host applies

Each parsed manifest, transitive ones included, resolves its own bare
owner/repo dependencies against its own default_host, so a root
default_host does not pin the whole graph. Say so in the
dependency-confusion row and point at host-qualified allow patterns as
the control.

Addresses supply-chain-security-expert delta panel finding on
docs/src/content/docs/enterprise/security.md:635.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Portable, content-bound approval for transitive MCP servers in apm.yml

2 participants