Skip to content

fix(0.37): finish owner hardening for bundle MCP, audit copies, failed installs, MCP targets and plugin pins - #3989

Merged
Daniel Meppiel (danielmeppiel) merged 71 commits into
mainfrom
danielmeppiel-0-37-owner-hardening-b
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 71 commits into
mainfrom
danielmeppiel-0-37-owner-hardening-b

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

This is PR B of the #3983 owner-hardening program. PR A (#3988) landed as 67936cd. The stack base is now #3996 (docs redesign): this PR targets danielmeppiel-docs-redesign-cdo-thesis, journey pages come from #3996 plus the CDO docs patch, and reference/apm-usage edits are kept. Following Daniel's no-deferral decision, the five issues first planned as 0.38 fallbacks ship fully in 0.37. Each one is fixed at its canonical owner, and that owner's guard refuses every caller except the approved ones (closed-world), with insertion mutation cases. This PR also folds in the native-plugin pin portability fix (option (a), decided by Daniel through the 0.37 captain).

Issue Owner Fix Guard
#3955 CurrentMcpConfigView Local-bundle servers (bundle:<owner> provenance) are recorded baseline: audit --ci and --frozen pass, and unrelated installs keep them. A package can never claim the bundle owner namespace. (harvested from #3972) mutation_mcp_target_and_scope (from #3972)
#3965 manifest_target_restriction (ManifestTargetDeclaration) apm pack on plugin-only packages warns about target:, vscode and compilation.target. (harvested from #3980) Closed-world: raw apm.yml readers must pass the manifest path. Only APMPackage-loaded configs (the MCP integrators) may omit it.
#2606 MCP target selection / owned MCP integration targets: on dependencies.mcp scopes each server, never leaks into native config, and stale pruning is per target. (harvested from #3951) #3951's guards and mutation cases
#3964 drift.locked_copy_proof A warm apm_modules copy that contradicts the lock routes audit --ci to the lock-pinned scratch replay, as a cold checkout does. It never repairs the live tree. Replay's own marker check now asks locked_copy_holds_commit. Closed-world: no copy-evidence re-derivation outside the owner modules, with 3 named exemptions for different decisions.
#3874 install pipeline (run_install_pipeline) Apply barrier: a direct dependency that failed to resolve or download stops the install before anything is integrated. The install-outcome rule requires _fail_before_integration before _run_integration_phase.
pin portability security/trust_fingerprint.native_plugin_fingerprint The committed plugin: pin covers path and bytes. The exec bit stays only in the per-machine integrity hash (compute_native_plugin_hash), so an approval made on macOS does not park on Windows. The trust-fingerprint rule requires the mode-less pin and refuses any other compute_native_plugin_pin caller.
#3990 install/exec_gate.lock_exec_decisions_stale The update probe compares each row with the effective gate, org policy included. Rows recorded gate-off are re-gated once a policy turns the gate on, as apm install does. Org policy is fetched only when a locked package declares executables. install-deployment-executable-trust-context: package_exec_decision and recorded_exec_status_is_stale have closed-world caller sets, plus 2 mutation cases.
#3991 recorded_exec_status_is_stale (#3944 owner) + security/trust.package_exec_decision A partially approved package records the types it deployed in the optional lock field exec_allowed_types. Staleness compares that set with the types allowed now, so removing one type's approval retires that type on apm update. This subsumes the denied+mixed rule and converges after one install. Same guard as #3990.
Red team R1 install pipeline apply barrier A direct local path that is not a package stops the apply before anything integrates, like a failed download. Install-outcome rule (same as #3874).
Red team R3 install/local_bundle_handler apm install -g <bundle> records bundle files (home-relative) and MCP servers in the user lockfile in $APM_HOME, so install -g --frozen and audit replay them. Bundle MCP owner guard.
Red team A1-A4 (#3962, #3963) LockFile.write, recorded_generator, pack lock enrichment A semantic no-op write keeps the file's bytes; removing the last untranslated pre-0.37 MCP claim hands the stamp to the writer; bundle reads warn on apm_version: null like project reads; packed bundle locks name the packer. contracts-tooling-lockfile-generator: destination-based stamp guard.
Red team A7 (#3957) apm approve bulk paths --all and --recommended skip a package that any layer denies (org included) and write no allow for it. Exact-approve guard.
#2606 x #3966 core/plugin_manifest pack projection A root apm.yml MCP server whose targets: leave out Claude is not embedded in the Claude plugin. Pack authored-source guard.
Security M1 (review 22c4267d) CurrentMcpConfigView / apm audit --ci A lock row claiming bundle:<owner> provenance cannot hide a denied MCP server: audit re-checks bundle-provenance servers against the gate. mutation_mcp_target_and_scope provenance cases.
Security M2 (review 22c4267d) effective_bundle_allow_map (trust owner caller) apm install -g <bundle> reads executables grants from $APM_HOME/apm.yml, never the working directory's apm.yml; skip messages name the right manifest. Trust-owner closed world (registered caller, manifest argument).
Security M4 (review 22c4267d) deps/apm_resolver marketplace replay A marketplace catalog edit cannot silently re-pin a locked package that owns MCP servers; the locked coordinates replay. marketplace_locked_evidence routes.
Red team P11 install/drift.diff_scratch_against_project -> policy/ci_checks.verify_deployed_file_hashes Plain apm audit and apm audit --ci reach the same verdict on an edited local-bundle file: both read its locked hash through the one deployed-hash verifier. install_frozen_and_audit deployed-hash routes (drift route added).
Red team P5 InstallLogger.record_mcp_removed Removing the last MCP server counts as a change: the summary says Removed N stale MCP server(s) instead of No changes. Lifecycle case in test_mcp_dependency_targets_lifecycle.py.

Spec: req-na-002's lock root digest is unchanged (it keeps modes). The Copilot/Codex approval pin is not the Section 8.5.11 activation approval. Per the 0.37 captain, any req-na-005 amendment travels with #3290.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Issue and approved scope

Issue: Refs #3983. The superseding scope record on #3983 moves #3955, #3964, #3965, #3874 and #2606 into 0.37 in full.

Fixes #3955
Fixes #3964
Fixes #3965
Fixes #3874
Fixes #2606
Fixes #3990
Fixes #3991

Does this PR complete the issue, or what remains? Together with #3988 it completes the #3983 must-ship tier and the five no-deferral issues. PR C (stacked on this one) carries the remaining #3967 polish items and #3940.

Supersedes: #3972, #3980, #3951.

Type of change

Testing

  • Tested locally (targeted only, per the host capacity rule; CI runs the full matrix)
  • All existing tests pass (CI)
  • Added tests for new functionality

Local evidence:

Changelog

Spec conformance (OpenAPM v0.1)

  • N/A -- see the waiver line above; the req-na-002 root digest is unchanged.

…nt (#3959)

Harvested from #3976; the positional install reads the lock lazily.

Co-authored-by: Copilot App <[email protected]>
…a same-store deny (#3957)

Harvested from #3979.

Co-authored-by: Copilot App <[email protected]>
A partial name could grant or deny execution for another package.

Co-authored-by: Copilot App <[email protected]>
… executables: (#3954)

exec_trust_context_for_project takes the manifest file instead of deriving
apm.yml from a caller-chosen root; -g resolves APM_HOME/apm.yml through
core.scope.get_manifest_path. A closed-world guard registers every caller.
Supersedes #3969 and keeps its lifecycle test.

Co-authored-by: Copilot App <[email protected]>
Every caller of the shared install entry now runs inside a registered
catalog-freshness envelope; the guard is closed-world.

Co-authored-by: Copilot App <[email protected]>
APM_NO_SCRIPTS, org executables.deny_all and project script trust now apply;
LifecycleScriptRunner is built only by build_runner_from_context, guarded
closed-world by the new lifecycle-script-firing-gate owner.

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

The only opt-out is a dependency's own authored .mcp.json; a closed-world
guard refuses any other.

Co-authored-by: Copilot App <[email protected]>
… the gate was never on (#3958)

Harvested from #3981 (b4cface, cb015e6); the trust read uses the scope manifest.

Co-authored-by: Copilot App <[email protected]>
Reads the manifest restriction through the same owner install uses.

Co-authored-by: Copilot App <[email protected]>
- compile's no-output hint names targets:, not the deprecated target:
- pack's mismatch hint no longer suggests the deprecated pack --target
- skip messages name executables.allow instead of allowExecutables
- origin and freshness errors say marketplace, not catalog
- generated apm.yml headers and unknown-target errors stop listing vscode
- config docs show default_client: copilot

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
…#3965)

Harvested from #3980. Raw apm.yml readers must pass the manifest path to
manifest_target_restriction; only APMPackage-loaded configs may omit it
(closed-world guard).

Co-authored-by: Copilot App <[email protected]>
…idity owner (#3964)

A warm copy that contradicts apm.lock.yaml routes audit to the lock-pinned
scratch replay, as a cold checkout does; replay's own marker check now asks
drift.locked_copy_holds_commit. The copy-validity guard is closed-world.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
…egration (#3874)

Every requested package resolves and downloads before any is integrated, so
a failed multi-package install leaves no untracked deployed files. Guarded
by the install-outcome rule.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

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

The committed plugin pin covers path and bytes; the exec bit stays only in
the per-machine integrity hash, because Windows derives it from file
extensions and an approval made on macOS would park on Windows. The
trust-fingerprint guard requires the mode-less pin and owns it closed-world.

apm-spec-waiver: approval pin binding is implementation-defined; root digest integrity unchanged

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Base automatically changed from danielmeppiel-docs-redesign-cdo-thesis to main November 20, 2026 06:28
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit d1389ce into main Nov 20, 2026
7 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-0-37-owner-hardening-b branch November 20, 2026 06:39
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Resolve exec_gate.py (native_plugin_verdict keeps its gate-off transitive
MCP check through the explicit gate-disabled map), local_bundle_handler.py
(scope-manifest bundle trust from #3989), and route the new
local_bundle_hook_trust.py adapter through the trust owner.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
… route (#3714)

Unit contracts: rendered TOML and claim hash, adopt/collision/--force/--dry-run,
render failure and non-Markdown sources write nothing, manifest-mismatch skip,
and a parameterized regression asserting every non-Codex agent target still
copies the packed bytes.

Installed-CLI lifecycle: project install, audit --ci, identical reinstall,
edited destination with and without --force, --dry-run, render failure, and
argument-free install --frozen without lockfile churn; user scope renders to
~/.codex/agents and $CODEX_HOME/agents. The $APM_HOME lock and audit check is
strict-xfail until #3989 (0.37 stack) moves the -g bundle lock root.

The bundle-native-layout guard now pins the rendered-format set, the loop
hand-off and the AgentIntegrator render/deploy route, with bypass mutations.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
…3714)

At user scope the bundle claim is an absolute path. Passing it as the
collision key made BaseIntegrator.check_collision index past the
destination's parents, so reinstalling over an edited ~/.codex/agents
file (or one under CODEX_HOME) crashed with IndexError instead of
keeping the edit. The collision key is now the destination relative to
the first root that contains it (project or home, else the deploy root);
the absolute record stays the lockfile claim.

Tests: a unit and an installed-CLI -g case (default home and CODEX_HOME)
edit the agent, reinstall without --force (kept) and with it (replaced);
both fail without the fix. Everything that works on main now passes
outside the strict xfail, including the rendered hash in $HOME's lock;
only the #3989-dependent $APM_HOME lock and audit stay strict-xfail.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
#3714)

#3989 moved the -g bundle lockfile to $APM_HOME with home-relative claims,
so the strict xfail is removed and the user-scope lifecycle asserts the
rendered hash there.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
… route (#3714)

Unit contracts: rendered TOML and claim hash, adopt/collision/--force/--dry-run,
render failure and non-Markdown sources write nothing, manifest-mismatch skip,
and a parameterized regression asserting every non-Codex agent target still
copies the packed bytes.

Installed-CLI lifecycle: project install, audit --ci, identical reinstall,
edited destination with and without --force, --dry-run, render failure, and
argument-free install --frozen without lockfile churn; user scope renders to
~/.codex/agents and $CODEX_HOME/agents. The $APM_HOME lock and audit check is
strict-xfail until #3989 (0.37 stack) moves the -g bundle lock root.

The bundle-native-layout guard now pins the rendered-format set, the loop
hand-off and the AgentIntegrator render/deploy route, with bypass mutations.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
…3714)

At user scope the bundle claim is an absolute path. Passing it as the
collision key made BaseIntegrator.check_collision index past the
destination's parents, so reinstalling over an edited ~/.codex/agents
file (or one under CODEX_HOME) crashed with IndexError instead of
keeping the edit. The collision key is now the destination relative to
the first root that contains it (project or home, else the deploy root);
the absolute record stays the lockfile claim.

Tests: a unit and an installed-CLI -g case (default home and CODEX_HOME)
edit the agent, reinstall without --force (kept) and with it (replaced);
both fail without the fix. Everything that works on main now passes
outside the strict xfail, including the rendered hash in $HOME's lock;
only the #3989-dependent $APM_HOME lock and audit stay strict-xfail.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
#3714)

#3989 moved the -g bundle lockfile to $APM_HOME with home-relative claims,
so the strict xfail is removed and the user-scope lifecycle asserts the
rendered hash there.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
… route (#3714)

Unit contracts: rendered TOML and claim hash, adopt/collision/--force/--dry-run,
render failure and non-Markdown sources write nothing, manifest-mismatch skip,
and a parameterized regression asserting every non-Codex agent target still
copies the packed bytes.

Installed-CLI lifecycle: project install, audit --ci, identical reinstall,
edited destination with and without --force, --dry-run, render failure, and
argument-free install --frozen without lockfile churn; user scope renders to
~/.codex/agents and $CODEX_HOME/agents. The $APM_HOME lock and audit check is
strict-xfail until #3989 (0.37 stack) moves the -g bundle lock root.

The bundle-native-layout guard now pins the rendered-format set, the loop
hand-off and the AgentIntegrator render/deploy route, with bypass mutations.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
…3714)

At user scope the bundle claim is an absolute path. Passing it as the
collision key made BaseIntegrator.check_collision index past the
destination's parents, so reinstalling over an edited ~/.codex/agents
file (or one under CODEX_HOME) crashed with IndexError instead of
keeping the edit. The collision key is now the destination relative to
the first root that contains it (project or home, else the deploy root);
the absolute record stays the lockfile claim.

Tests: a unit and an installed-CLI -g case (default home and CODEX_HOME)
edit the agent, reinstall without --force (kept) and with it (replaced);
both fail without the fix. Everything that works on main now passes
outside the strict xfail, including the rendered hash in $HOME's lock;
only the #3989-dependent $APM_HOME lock and audit stay strict-xfail.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
#3714)

#3989 moved the -g bundle lockfile to $APM_HOME with home-relative claims,
so the strict xfail is removed and the user-scope lifecycle asserts the
rendered hash there.

Co-authored-by: copilot-swe-agent[bot] <[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

2 participants