Skip to content

fix(approve): approve -g for parked native plugins; approval identity consistency - #4275

Merged
Daniel Meppiel (danielmeppiel) merged 33 commits into
mainfrom
godspeed-4154
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 33 commits into
mainfrom
godspeed-4154

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

Approval identity consistency and user-scope approval for native plugins.

  • apm approve -g <pkg>, apm deny -g and apm policy explain -g act on packages that apm install -g installed, from any directory.
  • Parked-executable notices print a command for the install's scope: security/trust.approve_command and explain_command, which correspond to remediation catalog ids executables-unapproved and executables-unapproved-user-scope. Path arguments are shell-quoted, and -g stays alongside --user.
  • apm approve reads 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.
  • A Codex bundle with unapproved executables is parked: nothing is registered or projected, and the notice names 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 deny and apm policy explain resolve every spec through the dependency selector that apm uninstall and apm audit PACKAGE use (select_installed_lock_key); security/executables.canonical_approval_spec then names the store identity.
    • A spec that matches no installed package, or more than one, exits 1 and writes nothing. Success is printed only on a match.
    • Approval stores are keyed by the package identity, so a deny by plugin@marketplace retires the package's executables on the next install, apm update and apm install --frozen.
  • A store entry keyed by an install spec is applied to the package identity when the store is read (canonicalize_store_keys, with a one-time note). The next apm approve or apm deny writes it under the identity.
  • For a denied package, apm policy explain names the deny entry and how to lift it, using the package identity.
  • The "bin/ executables skipped" line is printed only for a plugin that ships 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

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)
Node Result
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) green on branch
tests/integration/test_approval_identity_lifecycle.py (project and -g: approve and deny by plugin@marketplace; deny followed by install, update and --frozen with snapshots; a spec-keyed store entry; unmatched specs exit 1 without writing) green on branch
Guards install-deployment-approve-command and install-deployment-approval-store-identity, with MutationCases in tests/integration/test_architecture_owner_rule_mutations.py green on branch
Ledger rows 4154, 4189, 4245 and 4246 (tests/quality/test_lifecycle_bug_ledger.py) green on branch

Commands run locally on this branch, all passing:

  • uv run --extra dev ruff check and ruff format --check on src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
  • uv 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.sh
  • uv run --extra dev python scripts/check_complexity_ratchet.py --base-ref origin/main
  • uv run python scripts/lint_architecture_boundaries.py --root .
  • pytest on the approve, deny, identity, gate machine, Codex, Claude-native, trust and quality modules listed above

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

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.

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour.

@danielmeppiel Daniel Meppiel (danielmeppiel) changed the title fix(approve): approve -g finds parked native plugins; not found exits 1 (#4154) fix(approve): approve -g for parked native plugins; approval identity consistency (#4154) Nov 20, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Base automatically changed from danielmeppiel-4042-native-trust to main November 20, 2026 12:32
Copilot AI balanced review requested due to automatic review settings November 20, 2026 12:35
…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]>

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

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

Comment thread src/apm_cli/codex_plugins/admission.py Resolved
Comment thread src/apm_cli/commands/approve.py Resolved
Comment thread src/apm_cli/security/executables.py Resolved
Comment thread src/apm_cli/security/trust.py Resolved
…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]>
@danielmeppiel Daniel Meppiel (danielmeppiel) changed the title fix(approve): approve -g for parked native plugins; approval identity consistency (#4154) fix(approve): approve -g for parked native plugins; approval identity consistency Nov 20, 2026
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 6f860eb into main Nov 20, 2026
2 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the godspeed-4154 branch November 20, 2026 16:09
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
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]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants