Repository navigation
plan/apply P5a: ExecDecision, one executable trust owner (#4018) - #4025
Merged
Daniel Meppiel (danielmeppiel) merged 17 commits intoNov 20, 2026
Merged
Conversation
…efaults (#4018) Extend the executable-trust-context owner with an explicit blanket authorization (gate disabled, audit replay already-authorized), package type approvals and --trust-bin composition. check_executable_approval, the bundle helpers and resolve_bin_skip become adapters; a missing or omitted map no longer authorizes anything. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ide trust guard (#4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Closed
5 of 14 tasks
… guard (#4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ngelog (#4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…wner (#4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
Merged
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]>
…er 0.37 (#4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4018) The dry-run LSP preview reads the executable-trust-context owner (offline, policy-free) instead of the manifest's declared grants. First-party content gets an explicit AUTHORIZED_FIRST_PARTY map. Lazily resolved maps start from closed_exec_map(None), never None. The executable-trust-context guard gains a closed-world provenance check: every inventory function that takes an allow-map is a consumer, and every call to it outside security/ must pass an owner-produced map; mutation cases pin it. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…map shapes (#4018) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged
6 of 10 tasks
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
6 of 14 tasks
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 10:04
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 10:04
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-legendary-chainsaw
branch
November 20, 2026 10:11
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical provenance and trust-check bypasses allow raw executable grants to override owner deny rules and fail-open approval defaults to evade detection.
6 open issues
Resolve producers by canonical import and receiver · New Require provenance for non-empty closed map inputs · New Verify pass-through parameter provenance and caller coverage · New Inspect aliased approval calls in every inventory AST · New Retain function definitions for signature checks · New Read the selected source manifest for install previews · New
What changed in this PR
This PR advances #4018 by centralizing executable trust decisions in APM's security owner. Missing approval maps now deny executable deployment, while gate-disabled, replay, and first-party authorization become explicit.
Changes:
- Routes install, bundle, replay, and reintegration trust checks through shared owner APIs.
- Adds inventory-wide guards for approval inputs and allow-map provenance.
- Updates existing tests, adds equivalence and conformance coverage, and refreshes ownership records.
| File | Description |
|---|---|
| tests/unit/test_surviving_deps_reintegration.py | Supplies explicit authorization for reintegration testing. |
| tests/unit/security/test_resolve_exec_decision.py | Verifies explicit gate-disabled map materialization. |
| tests/unit/integration/test_hook_target_selection.py | Makes hook-test authorization explicit. |
| tests/unit/integration/test_hook_configured_routing.py | Updates routing fixtures for explicit authorization. |
| tests/unit/integration/test_dep_target_intersection.py | Preserves target-selection tests under the new contract. |
| tests/unit/integration/test_data_driven_dispatch.py | Authorizes dispatch fixtures explicitly. |
| tests/unit/integration/test_cursor_hook_native_contract.py | Updates hook-contract tests with authorization maps. |
| tests/unit/integration/test_command_integrator.py | Supplies authorization to command-dispatch tests. |
| tests/unit/integration/test_canvas_integrator.py | Supplies explicit authorization for canvas deployment. |
| tests/unit/install/test_skill_completion_receipt.py | Updates receipt tests for explicit authorization. |
| tests/unit/install/test_services.py | Updates service-test authorization inputs. |
| tests/unit/install/test_services_rendering.py | Preserves rendering tests with explicit maps. |
| tests/unit/install/test_services_phase3.py | Updates service-phase fixtures. |
| tests/unit/install/test_services_hook_scope.py | Authorizes hook-scope fixtures explicitly. |
| tests/unit/install/test_services_branches.py | Updates service-branch fixtures. |
| tests/unit/install/test_replay_exec_allow_map.py | Checks explicit replay authorization. |
| tests/unit/install/test_lsp_integration.py | Returns explicit gate-disabled maps from mocks. |
| tests/unit/install/test_local_bundle_hook_trust.py | Distinguishes gate-off authorization from missing maps. |
| tests/unit/install/test_install_local_bundle.py | Passes required bundle approval arguments. |
| tests/unit/install/test_exec_decision_equivalence.py | Adds trust-outcome equivalence and omission tests. |
| tests/unit/install/test_claude_native_hooks.py | Updates native-hook fixtures with explicit authorization. |
| tests/unit/install/test_claude_native_admission.py | Preserves gate-off transitive-MCP refusal coverage. |
| tests/unit/install/test_agent_symlink_diagnostics.py | Authorizes the diagnostic test fixture explicitly. |
| tests/unit/install/test_agent_plugin_deployment_boundary.py | Updates deployment-boundary test inputs. |
| tests/spec_conformance/test_exec_decision_reqs.py | Covers fail-closed approval and bin consent requirements. |
| tests/integration/test_plugin_bin_trust_posture.py | Makes authorization and interaction posture explicit. |
| tests/integration/test_install_services_phase3w5.py | Updates service integration fixtures. |
| tests/integration/test_install_services_orchestration.py | Updates orchestration fixtures. |
| tests/integration/test_hook_integrator_copilot_casing_e2e.py | Supplies explicit authorization for casing tests. |
| tests/integration/test_hook_configured_routing_e2e.py | Supplies explicit authorization for routing tests. |
| tests/integration/test_executables_gate_integration.py | Separates missing-map denial from gate-disabled approval. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds provenance and approval-boundary mutations. |
| tests/integration/test_architecture_lsp_plugin.py | Updates the bundle-identity bypass mutation. |
| src/apm_cli/security/executables.py | Owns explicit authorization, approval lookup, and bin consent. |
| src/apm_cli/integration/hook_integrator.py | Initializes unresolved reintegration trust closed. |
| src/apm_cli/install/template.py | Explicitly authorizes first-party deployment planning. |
| src/apm_cli/install/services.py | Routes canvas and bundle approvals through the owner. |
| src/apm_cli/install/lsp/integration.py | Starts lazy LSP trust resolution with a closed map. |
| src/apm_cli/install/local_bundle_paths.py | Requires explicit hook and canvas approval inputs. |
| src/apm_cli/install/local_bundle_hook_trust.py | Uses owner APIs for deployed bundle-hook admission. |
| src/apm_cli/install/local_bundle_handler.py | Uses owner APIs for bundle executable filtering. |
| src/apm_cli/install/exec_gate.py | Adapts approval, native admission, replay, and bin checks. |
| src/apm_cli/install/dry_run_plan.py | Resolves preview LSP trust through the context owner. |
| src/apm_cli/install/context.py | Clarifies unresolved-map semantics in comments. |
| src/apm_cli/commands/uninstall/engine.py | Initializes survivor reintegration trust closed. |
| scripts/architecture_linter/checks/install_trust_integrity.py | Updates the bundle-hook owner token. |
| scripts/architecture_linter/checks/install_portable_trust.py | Adds inventory-wide approval and admission checks. |
| scripts/architecture_linter/checks/install_lsp_plugin.py | Registers owner APIs and provenance enforcement. |
| scripts/architecture_linter/checks/install_exec_provenance.py | Adds allow-map consumer and provenance analysis. |
| scripts/architecture_linter/checks/install_dry_run_plan.py | Updates the dry-run call-shape guard. |
| CONFORMANCE.md | Updates executable-trust requirement test counts. |
| CONFORMANCE.json | Records new executable-trust conformance cases. |
| CHANGELOG.md | Records the internal trust-owner refactor. |
| .apm/architecture/owners/install-deployment.json | Expands the executable-trust ownership contract. |
Review effort: Balanced
Comment on lines
+95
to
+97
| def _is_producer(value: ast.AST | None) -> bool: | ||
| if isinstance(value, ast.Call): | ||
| return _callee(value) in _PRODUCERS |
Comment on lines
+95
to
+97
| def _is_producer(value: ast.AST | None) -> bool: | ||
| if isinstance(value, ast.Call): | ||
| return _callee(value) in _PRODUCERS |
Comment on lines
+143
to
+144
| if enclosing is not None and value.id in _params(enclosing): | ||
| return True |
Comment on lines
+188
to
+193
| names = tuple(consumers) | ||
| for path in _python_paths(provider, _SRC): | ||
| if path in trees or path.startswith(_SECURITY): | ||
| continue | ||
| facts, failures = _facts_for(provider, path, rule_id) | ||
| if not failures and any(name + "(" in line for line in _lines(facts) for name in names): |
| found = [token for token in _BOOL_LOOKUPS if _present(facts, token)] | ||
| if found: | ||
| def _code_lines(facts: object) -> list[str]: | ||
| return [line for line in _lines(facts) if not line.lstrip().startswith(("#", "def "))] |
| allow_map = materialize_exec_map( | ||
| exec_trust_context_for_project( | ||
| project_manifest_path( | ||
| manifest_root(ctx.project_root, user_scope=is_user_scope(ctx.scope)) |
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
install_portable_trust.py: keep #4025's inventory-wide guard; approve.py routes keep the native_declaration calls (#4042), and native plugin type derivation outside trust.py stays rejected. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
2 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
TL;DR — Executable trust now has one owner with no fail-open defaults.
security/executables.pygains an explicit blanket authorization (authorized_exec_map) for the two cases that legitimately approve everything (gate disabled, audit replay of already-authorized rows); aNoneor omitted approvals map now approves nothing.check_executable_approval, the local-bundle helpers andresolve_bin_skipbecome adapters over that owner, and the portable-trust guard moves from caller lists to inventory-wide enforcement. Installed-CLI outcomes are unchanged.Problem (WHY)
allow_executables is Nonemeant "approve every executable" incheck_executable_approval,plugin_admission,hook_file_admission, the services canvas gate, the local-bundle hooks/canvas/MCP/LSP filters and the declared-service filter. Any caller that forgot to pass a map silently got full trust.bundle_deploy_relative_path/bundle_deploy_skip_warningdefaultedhooks_approved=True, canvas_approved=True;resolve_bin_skipdefaultednon_interactive=False(trusting bin/ on an omitted input).is_package_approvedlookups (services canvas, local-bundle hooks/canvas/MCP/LSP), beside the owner.Approach (WHAT)
Nonemap ⇒ all approvedNone⇒ nothing approved;authorized_exec_map(AUTHORIZED_GATE_DISABLED | AUTHORIZED_REPLAY)⇒ all approvedmaterialize_exec_mapreturnsNonewhen the gate is offEffectiveExecMap(still empty, stilltrust_context=None)_localtrusted via theNone-or-name shortcutFIRST_PARTY_PACKAGEchecked explicitlyis_package_approvedpackage_type_approved(s); native and pinned-hook item admission unchanged--trust-bincomposition inexec_gate.pycompose_trust_binin the owner;non_interactiverequiredhooks_approved/canvas_approveddefaultTrueImplementation (HOW)
security/executables.pyEffectiveExecMap.authorized_by;authorized_exec_map,exec_map_authorizes_all,package_type_approved(s),compose_trust_bin,closed_exec_map,declared_project_exec_map;materialize_exec_mapreturns the explicit gate-disabled map.install/exec_gate.pycheck_executable_approval,plugin_admission,hook_file_admissionroute through the owner; a missing map reaches native admission as an empty gate-on map (fails closed).ReplayExecAllowMap.for_dependencyreturnsAUTHORIZED_REPLAYinstead ofNone.resolve_bin_skipdelegates;non_interactiverequired.install/services.py,install/local_bundle_handler.py,install/local_bundle_paths.py,install/dry_run_plan.pyis Nonebranches; bundle approval inputs are required keyword-only.scripts/architecture_linter/checks/install_portable_trust.pysrc/apm_cli/: no approval lookups or approvals-mapis Nonetests outsidesecurity/; every def takinghooks_approved/canvas_approved(ornon_interactivewithtrust_bin) declares them required keyword-only and every call passes them (hook_file_admittedtoo when hooks may be approved); any function callingpackage_type_approvalsalso callsnative_installandhooks_package_admissible;package_exec_statusalways getsnative=; grants are written only byapm approveand the install prompt. Existing owner-boundary prohibitions kept.scripts/architecture_linter/checks/install_lsp_plugin.py,.apm/architecture/owners/install-deployment.jsonLegend: who may authorize every executable, and how each adapter reaches a verdict.
flowchart LR M["materialize_exec_map"] -->|"gate off"| A["authorized_exec_map: gate-disabled"] R["ReplayExecAllowMap"] -->|"already authorized"| B["authorized_exec_map: replay"] M -->|"gate on"| G["EffectiveExecMap grants"] N["None / omitted"] --> C["closed: nothing approved"] A --> X["exec_gate adapters"] B --> X G --> X C --> X X --> P["package_type_approved(s)"] X --> I["trust.py item admission: pins, native plugins"]Trade-offs
Nonenow fails closed instead of raising. Every production producer passes an explicit map, and the guard forbidsis Nonetests on approvals maps outsidesecurity/; raising would have added churn to the 90+ internalintegrate_package_primitivestest calls for no outcome difference.trust_context=None, soMcpAdmissionstill resolves its own context exactly as before (no change topolicy_unavailablereporting).allow_executablesonintegrate_package_primitives/prepare_package_deploymentkeeps itsNonedefault (now meaning "nothing approved") rather than becoming required; the scope names only the bundle and trust-bin inputs as required.apm approvekeeps one presence token (record_pins) as the registered grant writer; there is no inventory-wide shape for "pins what it approves".Validation
tests/unit/install/test_exec_decision_equivalence.py(12 cases: no policy signals, org deny, user deny, pinned hooks, native plugin, bin with/without--trust-bin, audit replay) uses only APIs present onmainand passes unchanged on bothmainand this branch.uv run --extra dev pytest tests/unit -n 8: 312 failed / 28204 passed on this branch vs 313 failed onmainin the same sandbox; zero failures not present onmain(the shared failures are sandbox git-signing / network / locale tests).tests/acceptance tests/red_team tests/spec_conformance tests/mutation tests/scripts tests/quality tests/test_*.py: identical pass/fail sets on branch andmain.bash scripts/lint-architecture-boundaries.sh: exit 0. New mutation-break cases (test_executable_approval_cannot_leave_the_trust_owners, 7 cases) all rejected byinstall-deployment-executable-item-admission.0bf3951: all 30 checks pass (Lint, Build & Test shards, Windows Compatibility Gate, Spec conformance gate, Architecture Ratchets, Lifecycle Smoke, Binary Smoke). A localtests/integrationrun did not finish in the sandbox (stopped after 45 min); CI's Build & Test shards cover it.Scenario evidence
test_no_policy_signals_deploy_every_executabletest_org_deny_withholds_every_executable,test_user_deny_beats_a_project_granttest_pinned_hooks_admit_per_filetest_native_plugin_is_admitted_as_one_pinned_unit--trust-bintest_bin_composes_approval_with_trust_bintest_audit_replay_keeps_already_authorized_rowstest_missing_or_omitted_inputs_never_authorize,tests/spec_conformance/test_exec_decision_reqs.py(req-sc-009, req-sc-014)hooks_approvedtests/integration/test_architecture_owner_rule_mutations.py::test_executable_approval_cannot_leave_the_trust_ownersRebased on 0.37 main
Merged
main(0.37 stack) in one merge commit; conflicts inexec_gate.py,local_bundle_handler.py, CHANGELOG and two tests. Semantic folds:native_plugin_verdictkeeps 0.37's gate-off rule (a transitive plugin with MCP servers still needs trust): the explicit gate-disabled map maps toctx.exec_trust_ctx, replay to no context, a missing map fails closed.local_bundle_hook_trust.py("None= gate off") routes through the owner (exec_map_authorizes_all,package_type_approved); its trust-integrity guard token and mutation case follow.package_exec_decision.Allow-map provenance (closed world)
install/dry_run_plan.pyreads the executable-trust-context owner (offline, policy-free, no migration or warnings) instead of the manifest's declared grants; registered as a trust-owner caller.AUTHORIZED_FIRST_PARTYmap (template.py,services.integrate_local_content); lazily resolved maps start fromclosed_exec_map(None), neverNone(lsp/integration.py,hook_integrator.py,uninstall/engine.py).scripts/architecture_linter/checks/install_exec_provenance.pyunderinstall-deployment-executable-trust-context: every inventory function with anallow_executables/effective_allow_execsparameter is a consumer, discovered not listed; every call outsidesecurity/must pass an owner-produced map (producer call, pass-through parameter, local name or provider bound only to producers). Mutation cases: manifest grants in dry-run, omitted first-party map, literalNone,Noneplaceholder.Issue and approved scope
Issue: Fixes #4018
Human scope-approval comment: #4018 (comment)
Completes the issue: owner extension, adapters, removed fail-open defaults, inventory-wide guard, equivalence and mutation tests, one CHANGELOG line. Out of scope (untouched): default-allow changes, new policy fields, pin semantics, lifecycle script gating.
Type of change
Testing
mainin the same sandbox)How to test
uv run --extra dev pytest tests/unit/install/test_exec_decision_equivalence.py tests/spec_conformance/test_exec_decision_reqs.py -qtest_exec_decision_equivalence.pyminus its last test ontomainand run it: same results.uv run --extra dev pytest "tests/integration/test_architecture_owner_rule_mutations.py::test_executable_approval_cannot_leave_the_trust_owners" -qbash scripts/lint-architecture-boundaries.shexits 0.Changelog
## [Unreleased]inCHANGELOG.md(internal line underChanged, as the scope requires).Spec conformance (OpenAPM v0.1)
tests/spec_conformance/test_exec_decision_reqs.pycitesreq-sc-009andreq-sc-014(no normative change).CONFORMANCE.{md,json}regenerated and committed.Co-authored-by: Copilot [email protected]