Repository navigation
fix(approve): approve -g for parked native plugins; approval identity consistency - #4275
Conversation
… 1 (#4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…il approved (#4154) 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]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…to the store identity (#4189, #4245, #4246) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4245, #4246) 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]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Krish Khinchi (krishkhinchi)
left a comment
There was a problem hiding this comment.
Good overall fix, particularly the unified approval identity resolution and lifecycle coverage. However, the 1,003-line change touches several security-critical paths, so I'd like stronger verification of edge cases around ambiguous marketplace identities, stale lockfile provenance, and user/project scope isolation. Please also ensure that failed or unmatched approval requests never modify the approval store and that parked Codex bundles remain completely unregistered until explicitly approved. Recommendation: Request Changes until these security and lifecycle edge cases are verified.
… -g (#4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…alize install-spec store keys on read (#4189) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…r raw-spec deny honored after upgrade (#4189) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4275) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unmatched package specs can write deny entries or leave partial approvals, while generated approval hints mishandle paths with spaces, global installation scope, and denied plugins.
4 open issues
What changed in this PR
This PR improves APM's executable-approval workflow for parked native plugins and marketplace packages, building on #4058 to address #4154, #4189, #4245 and #4246.
Changes:
- Adds user-scope approval, denial and explanation commands, with scope-aware remediation hints.
- Resolves marketplace specs to installed approval identities and parks unapproved Codex bundles instead of failing installation.
- Adds lifecycle coverage, architecture guards and documentation for the updated trust workflow.
| File | Description |
|---|---|
| tests/unit/test_codex_native_admission.py | Tests parking and read-only refusal. |
| tests/unit/security/test_trust_admission.py | Updates user-scope hint expectations. |
| tests/unit/scripts/test_architecture_runner.py | Registers new guard expectations. |
| tests/unit/install/test_claude_native_admission.py | Updates Claude approval hints. |
| tests/unit/commands/test_approve_deny.py | Updates unmatched-package exit expectations. |
| tests/integration/test_executables_gate_integration.py | Checks unsuccessful approval exits. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds mutations for approval guards. |
| tests/integration/test_approve_parked_native_plugin_lifecycle.py | Exercises parked plugins and printed commands. |
| tests/integration/test_approval_identity_lifecycle.py | Exercises marketplace approval and denial. |
| tests/fixtures/lifecycle_bug_ledger.json | Records regression coverage for four issues. |
| src/apm_cli/security/trust.py | Centralizes scoped hints and scan-directory selection. |
| src/apm_cli/security/executables.py | Resolves marketplace approval identities. |
| src/apm_cli/integration/mcp_config_view.py | Adds scoped MCP remediation hints. |
| src/apm_cli/install/target_warnings.py | Uses the shared approve-command renderer. |
| src/apm_cli/install/phases/integrate.py | Preserves scope in approval guidance. |
| src/apm_cli/install/native_plugin_admission.py | Updates native registration guidance. |
| src/apm_cli/install/exec_gate.py | Adds scope-aware skip guidance. |
| src/apm_cli/install/deployment_plan.py | Passes scope into parked notices. |
| src/apm_cli/core/scope.py | Identifies the user-scope manifest root. |
| src/apm_cli/commands/policy.py | Adds policy explain -g. |
| src/apm_cli/commands/approve.py | Adds scope selection, spec resolution and revised outcomes. |
| src/apm_cli/codex_plugins/admission.py | Parks unapproved Codex bundles. |
| src/apm_cli/claude_plugins/admission.py | Uses user-scope approval hints. |
| scripts/validate-1061-real-world.py | Formatting only. |
| scripts/perf/measure_dotnet_skills.py | Formatting only. |
| scripts/generate-notice.py | Formatting only. |
| scripts/bootstrap_requirements.py | Formatting only. |
| scripts/benchmark_manifest_ops.py | Formatting only. |
| scripts/architecture_linter/groups/contracts_tests.py | Registers approval-related rules. |
| scripts/architecture_linter/checks/marketplace_package_and_registration.py | Updates Codex parking guard expectations. |
| scripts/architecture_linter/checks/install_approve_command.py | Guards hint construction and identity routing. |
| packages/apm-guide/.apm/skills/apm-usage/commands.md | Documents updated approval behavior. |
| docs/src/content/docs/reference/cli/approve.md | Documents global scope and failure exits. |
| CHANGELOG.md | Records user-visible approval fixes. |
| .apm/architecture/owners/install-deployment.json | Extends trust ownership and guard references. |
Review effort: Balanced
…ex bundle satisfies req-sc-009 (#4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4189) 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]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…g hints; one codex parked notice (#4189, #4154) Addresses review: never record a deny that matches no installed package; apm policy explain of an uninstalled package exits 1; approve and explain hints quote path arguments and keep -g beside --user; a codex bundle the trust owner already reported as denied gets no second generic notice. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4275) 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]>
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]>
…4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
#4154) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Main's scope-aware approve_command/explain_command (#4154, #4275) and _install_command now feed the catalog remediations through Remediation.with_command, so the advice keeps catalog wording and gains the -g form. Generator anchors follow main; obligations regenerated. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4275 lift remedy Required, no xfail: verdict blocked (layer user-deny), no 'not approved' wording, no standalone 'Approve:' hint, and the only 'apm approve' mention sits in the 'To lift it' sentence naming the executables.deny entry. Steward-approved. Co-authored-by: Copilot App <[email protected]>

Description
Approval identity consistency and user-scope approval for native plugins.
apm approve -g <pkg>,apm deny -gandapm policy explain -gact on packages thatapm install -ginstalled, from any directory.security/trust.approve_commandandexplain_command, which correspond to remediation catalog idsexecutables-unapprovedandexecutables-unapproved-user-scope. Path arguments are shell-quoted, and-gstays alongside--user.apm approvereads the same unit the install gate parked (security/trust.approval_scan_dir). For a native plugin, that is the normalized copy whose manifest carries the plugin's MCP servers.apm approve -g <pkg>. Read-only replay refuses it. A bundle whose deny the trust owner has already reported gets a single notice.apm approve,apm denyandapm policy explainresolve every spec through the dependency selector thatapm uninstallandapm audit PACKAGEuse (select_installed_lock_key);security/executables.canonical_approval_specthen names the store identity.plugin@marketplaceretires the package's executables on the next install,apm updateandapm install --frozen.canonicalize_store_keys, with a one-time note). The nextapm approveorapm denywrites it under the identity.apm policy explainnames the deny entry and how to lift it, using the package identity.bin/.Issue and approved scope
Issue: Fixes #4154
Fixes #4189
Fixes #4245
Fixes #4246
Human scope-approval comment: #4154 (comment)
This PR completes all four issues.
Type of change
Testing
tests/integration/test_approve_parked_native_plugin_lifecycle.py(Claude and Codex at user scope with APM_HOME outside HOME; runs every printed hint; checks lock against disk; deny retires the plugin)tests/integration/test_approval_identity_lifecycle.py(project and-g: approve and deny byplugin@marketplace; deny followed by install, update and--frozenwith snapshots; a spec-keyed store entry; unmatched specs exit 1 without writing)install-deployment-approve-commandandinstall-deployment-approval-store-identity, with MutationCases intests/integration/test_architecture_owner_rule_mutations.pytests/quality/test_lifecycle_bug_ledger.py)Commands run locally on this branch, all passing:
uv run --extra dev ruff checkandruff format --checkonsrc/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.pyuv run --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ ...(10.00)bash scripts/lint-auth-signals.shuv run --extra dev python scripts/check_complexity_ratchet.py --base-ref origin/mainuv run python scripts/lint_architecture_boundaries.py --root .pyteston the approve, deny, identity, gate machine, Codex, Claude-native, trust and quality modules listed aboveChangelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
apm-spec-waiver: approval hints name the install scope and specs resolve to the locked identity; req-sc-009 holds (an unapproved Codex bundle is parked, never deployed) and its conformance test asserts that.
CONFORMANCE.{md,json}regenerated