Repository navigation
fix: 0.36.0 hardening of trust boundaries for credentials, deploy destinations, bundles and MCP consent - #3716
Conversation
Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: hardening of existing install, update, uninstall and MCP trust boundaries; no OpenAPM v0.1 requirement changes Co-authored-by: Copilot App <[email protected]>
48a7db9 to
03d1e59
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical flaws allow bundle extraction to modify external directories and credentials to reach unintended origins, while MCP state inconsistencies can cause subsequent audits to fail.
5 open issues
Validate empty-directory destinations before copying · New Preserve registry ports when routing credentials · New Strip credentials on HTTP-to-HTTPS redirects · New Apply executable exclusions to audit views and omission evidence · New Record omission evidence after transitive server retirement · New
What changed in this PR
This PR delivers the security-hardening portion of #3649’s pre-release regression sweep, tightening trust boundaries across APM’s dependency lifecycle.
Changes:
- Restricts credential forwarding and hardens MCP configuration writes.
- Adds deployment containment, bundle routing restrictions, and ownership-based cleanup.
- Strengthens manifest-pin enforcement, executable authorization, and per-run MCP consent, with regression tests, architecture guards, and documentation.
| File | Description |
|---|---|
tests/utils/local_header_capture_proxy.py |
Adds a local HTTPS proxy for observing credential headers. |
tests/unit/utils/test_url_host_agreement.py |
Tests rejection of ambiguous credential-bearing URLs. |
tests/unit/utils/test_http_credentials.py |
Tests credential handling across redirects. |
tests/unit/test_unpack_security.py |
Adds unpack destination and symlink containment cases. |
tests/unit/test_transitive_mcp.py |
Tests transitive trust classification and URL validation. |
tests/unit/test_drift_detection.py |
Tests full-SHA pin consistency. |
tests/unit/test_copilot_adapter.py |
Tests host validation and owner-only config permissions. |
tests/unit/test_copilot_adapter_phase3.py |
Supplies project roots for scoped config tests. |
tests/unit/test_copilot_adapter_compatibility.py |
Aligns config fixtures with project-scope checks. |
tests/unit/test_artifactory_support.py |
Tests registry credential scoping and missing-URL warnings. |
tests/unit/scripts/test_architecture_runner.py |
Registers expected new architecture guards. |
tests/unit/policy/test_discovery.py |
Expects no environment fallback after resolver failure. |
tests/unit/policy/test_discovery_policy_resolution.py |
Updates resolver-failure credential expectations. |
tests/unit/policy/test_discovery_phase3w4.py |
Covers resolver-only policy credentials. |
tests/unit/policy/test_chain_discovery_shared.py |
Tests accepted policy-disable values. |
tests/unit/integration/test_targets.py |
Tests refusal of symlinked primitive directories. |
tests/unit/integration/test_skill_integrator_phase3w4.py |
Removes tests for deleted legacy cleanup. |
tests/unit/integration/test_skill_integrator_hermetic.py |
Removes obsolete orphan-cleanup cases. |
tests/unit/integration/test_skill_cleanup_containment.py |
Tests preservation of unowned skills. |
tests/unit/integration/test_mcp_config_view.py |
Replaces persisted trust expectations with per-run consent. |
tests/unit/integration/test_lsp_integrator.py |
Removes the obsolete legacy-cleanup reservation test. |
tests/unit/integration/test_hook_merge_config_links.py |
Tests project hook-config symlink refusal. |
tests/unit/integration/test_hook_integrator.py |
Supplies explicit hook selection for fallback preflight. |
tests/unit/integration/test_check_collision.py |
Tests symlink refusal regardless of ownership or force. |
tests/unit/install/test_install_local_bundle.py |
Tests primitive routing and bundle executable gates. |
tests/unit/deps/test_github_downloader_phase3.py |
Updates origin-aware header delegation assertions. |
tests/unit/deps/test_github_downloader_error_handling.py |
Updates origin-aware downloader compatibility tests. |
tests/unit/deps/test_download_strategies_selection.py |
Tests scoped registry-header delegation. |
tests/unit/deps/test_download_strategies_phase3.py |
Removes legacy unscoped-token expectations. |
tests/unit/core/test_lifecycle_scripts.py |
Tests script suppression after blocking policy failures. |
tests/unit/commands/compile/test_pre_compile_scripts.py |
Adds policy outcome metadata to compile fixtures. |
tests/unit/adapters/test_project_mcp_config_links.py |
Tests adapter refusal of linked project configs. |
tests/integration/test_wave8_codex_download_coverage.py |
Updates registry-origin credential expectations. |
tests/integration/test_update_transitive_mcp_trust_lifecycle.py |
Tests per-invocation MCP trust during update. |
tests/integration/test_unpack_destination_containment_lifecycle.py |
Exercises unpack containment through the CLI. |
tests/integration/test_symlinked_mcp_config_lifecycle.py |
Exercises linked MCP-config refusal across runtimes. |
tests/integration/test_symlinked_hook_settings_lifecycle.py |
Tests hook-settings containment during install. |
tests/integration/test_symlinked_deploy_directory_lifecycle.py |
Tests linked deployment directories and destination files. |
tests/integration/test_skill_cleanup_containment_lifecycle.py |
Checks linked skills remain untouched without ownership. |
tests/integration/test_revision_pin_lock_consistency_lifecycle.py |
Exercises SHA-pin enforcement across install and audit. |
tests/integration/test_removal_reintegration_executables_lifecycle.py |
Tests executable decisions during uninstall and prune. |
tests/integration/test_registry_credential_origin_lifecycle.py |
Observes registry and GitLab credential destinations. |
tests/integration/test_package_mcp_executables_gate_lifecycle.py |
Tests MCP authorization by declaring package identity. |
tests/integration/test_lockfileless_skill_cleanup_lifecycle.py |
Tests project and global lockfileless skill preservation. |
tests/integration/test_local_bundle_primitive_paths_lifecycle.py |
Exercises bundle primitive routing and hook authorization. |
tests/integration/test_executables_deny_identity_lifecycle.py |
Tests deny rules across package identity spellings. |
tests/integration/test_download_copilot_end_to_end.py |
Updates scoped headers and GitLab session expectations. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds mutations for the new ownership guards. |
tests/integration/test_architecture_materialization_receipts.py |
Removes the deleted cleanup-path mutation. |
tests/integration/test_architecture_dependency_reference.py |
Targets the shared revision-pin comparison helper. |
tests/integration/_containment_kit.py |
Adds shared containment lifecycle fixtures. |
src/apm_cli/utils/http_credentials.py |
Introduces shared redirect credential handling. |
src/apm_cli/utils/github_host.py |
Adds URL ambiguity checks for credential decisions. |
src/apm_cli/policy/install_preflight.py |
Uses the shared policy-disable reader. |
src/apm_cli/policy/discovery.py |
Centralizes policy disabling and resolver-only credentials. |
src/apm_cli/policy/ci_checks.py |
Uses shared full-SHA consistency checking. |
src/apm_cli/models/dependency/mcp.py |
Adds approval metadata, trust classification, and URL validation. |
src/apm_cli/marketplace/client.py |
Uses the credential-scoped HTTP session. |
src/apm_cli/integration/targets.py |
Rejects symlinked primitive deployment directories. |
src/apm_cli/integration/skill_support.py |
Removes name-based orphan cleanup helpers. |
src/apm_cli/integration/skill_integrator.py |
Requires ownership and validates cleanup paths. |
src/apm_cli/integration/mcp_config_view.py |
Applies per-run trust and records package approval keys. |
src/apm_cli/integration/lsp_integrator.py |
Removes obsolete legacy-cleanup reservations. |
src/apm_cli/integration/hook_ownership.py |
Adds guarded reads of merged hook settings. |
src/apm_cli/integration/hook_integrator.py |
Preserves authorization during selection and removal rebuilds. |
src/apm_cli/integration/base_integrator.py |
Rejects symlinked destination files during collision checks. |
src/apm_cli/install/services.py |
Passes hook and canvas approval into bundle routing. |
src/apm_cli/install/service_integration.py |
Propagates executable context into MCP integration. |
src/apm_cli/install/plan.py |
Uses shared manifest-pin mismatch detection. |
src/apm_cli/install/phases/policy_gate.py |
Uses the canonical policy-disable helper. |
src/apm_cli/install/mcp/integration.py |
Filters package MCP servers through effective executable decisions. |
src/apm_cli/install/lsp/integration.py |
Uses the shared executable-map resolver. |
src/apm_cli/install/local_bundle_paths.py |
Restricts bundle routing to approved primitive paths. |
src/apm_cli/drift.py |
Centralizes full-SHA pin versus lockfile comparison. |
src/apm_cli/deps/registry_proxy.py |
Adds scoped header selection and missing-URL warnings. |
src/apm_cli/deps/github_downloader.py |
Requires origin arguments for registry headers. |
src/apm_cli/deps/download_strategies.py |
Scopes registry headers and GitLab redirect credentials. |
src/apm_cli/deps/artifactory_entry.py |
Delegates redirect stripping to the shared helper. |
src/apm_cli/core/lifecycle_scripts.py |
Applies policy failure outcomes to script suppression. |
src/apm_cli/commands/update.py |
Adds and propagates per-run transitive MCP consent. |
src/apm_cli/commands/uninstall/engine.py |
Preserves effective executable decisions and managed MCP scope. |
src/apm_cli/commands/install.py |
Reuses the shared transitive MCP option. |
src/apm_cli/commands/audit.py |
Uses consistent policy-disable semantics. |
src/apm_cli/commands/_helpers.py |
Defines shared transitive MCP consent help. |
src/apm_cli/bundle/unpacker.py |
Validates destinations before copying bundle contents. |
src/apm_cli/adapters/client/vscode.py |
Refuses linked MCP configuration writes. |
src/apm_cli/adapters/client/kiro.py |
Rejects linked project configs and propagates failure. |
src/apm_cli/adapters/client/copilot.py |
Hardens config writes and credential-host validation. |
src/apm_cli/adapters/client/claude.py |
Rejects linked project MCP configs. |
src/apm_cli/adapters/client/base.py |
Centralizes config-link checks and owner-only writes. |
scripts/architecture_linter/checks/transport_revision_pins.py |
Guards shared revision-pin consistency ownership. |
scripts/architecture_linter/checks/transport_auth_platform.py |
Guards credential scoping and consumer delegation. |
scripts/architecture_linter/checks/mutation_mcp_target_and_scope.py |
Requires canonical transitive trust classification. |
scripts/architecture_linter/checks/install_policy_plugin_and_approval.py |
Guards the single policy-disable reader. |
scripts/architecture_linter/checks/install_policy_intent.py |
Registers the policy-disable ownership rule. |
scripts/architecture_linter/checks/install_lsp_plugin.py |
Updates executable-context guards and removes obsolete checks. |
scripts/architecture_linter/checks/install_base_integrator_and_contraction.py |
Removes guards for deleted cleanup code. |
scripts/architecture_linter/checks/contracts_test_taxonomy.py |
Updates the dependency-identity guard for shared pin checking. |
packages/apm-guide/.apm/skills/apm-usage/dependencies.md |
Documents trust requirements for transitive MCP overlays. |
packages/apm-guide/.apm/skills/apm-usage/authentication.md |
Documents proxy-token scope and missing-URL behavior. |
docs/src/content/docs/reference/environment-variables.md |
Clarifies deprecated Artifactory token handling. |
docs/src/content/docs/reference/cli/update.md |
Documents per-run transitive MCP consent. |
docs/src/content/docs/reference/cli/unpack.md |
Documents managed destinations and symlink handling. |
docs/src/content/docs/reference/cli/uninstall.md |
Documents lockfileless skill preservation. |
docs/src/content/docs/reference/cli/install.md |
Expands transitive MCP consent documentation. |
docs/src/content/docs/producer/author-primitives/mcp-as-primitive.md |
Explains trust requirements for registry overrides. |
docs/src/content/docs/enterprise/security.md |
Describes hardened identity, deployment, and consent boundaries. |
docs/src/content/docs/enterprise/registry-proxy.md |
Clarifies proxy credential scope and deprecated aliases. |
docs/src/content/docs/enterprise/lifecycle-scripts.md |
Documents suppression when policy enforcement blocks. |
CHANGELOG.md |
Records security fixes and user-visible behavior changes. |
.apm/architecture/owners/transport-auth-platform.json |
Registers credential-boundary owners and their guard. |
.apm/architecture/owners/marketplace-plugins.json |
Extends ownership to full-SHA lock consistency. |
.apm/architecture/owners/install-deployment.json |
Records the shared executable-map resolver. |
.apm/architecture/owners/contracts-tooling.json |
Registers policy-disable ownership and its guard. |
Review effort: Balanced
…ked commit (#3649) A dependency pinned to a full commit SHA in apm.yml is satisfied only by a lock row whose resolved_commit names that same commit. Plain `apm install` now re-resolves the pinned commit when the row records another one, matching `apm install --frozen` and `apm audit --ci` ref consistency. The comparison lives in one helper, drift.revision_pin_mismatch, consumed by detect_ref_change, marketplace_ref_mismatch, lockfile_satisfies_manifest and the audit ref-consistency check, with an architecture guard and mutation case. Co-authored-by: Copilot App <[email protected]>
…their hook files (#3649) Local bundle install routes a packed file to a target only when it lands in a primitive directory that target owns. Files directly under a target root and directories no primitive mapping owns are skipped with a warning. Target-rooted hook files follow the executables gate through the bundle's content-bound approval key, like canvas files. Co-authored-by: Copilot App <[email protected]>
03d1e59 to
ed85dbe
Compare
…kage identity (#3649) Self-defined MCP servers declared by a dependency now follow the same deny-wins executables ladder as hooks and LSP servers. Each collected server carries the approval keys of its locked declaring package, and the MCP and LSP filters share one implementation keyed by those identities. A single resolver, resolve_project_exec_allow_map, returns the effective map from org policy, project and user layers, and the LSP and MCP paths both use it. The architecture rule records the new owner tokens. Co-authored-by: Copilot App <[email protected]>
…after removal (#3649) apm uninstall and apm prune rebuild surviving packages through the effective executables map from resolve_project_exec_allow_map instead of the legacy allowExecutables field alone. Hook source selection returns an empty selection when an authorized source plan carries none, so a plan without approved hooks never falls back to a fresh selection. Co-authored-by: Copilot App <[email protected]>
…3649) Org, project, and user deny rules now compare the package's canonical identity, so shorthand, host-qualified, URL, and case variants of one package resolve to the same decision. Org deny entries also cover sub-packages below the denied path. Allow matching is unchanged. Co-authored-by: Copilot App <[email protected]>
Local bundle routing applies the canvas approval to the target-relative path, so namespace-prefixed canvas files follow the same gate as plain ones. Deny pattern matching ignores empty entries. Co-authored-by: Copilot App <[email protected]>
…osts (#3649) GitHub token injection for MCP servers now derives the host through unambiguous_https_hostname(), which returns a host only for absolute https URLs without userinfo or parser-dependent characters. MCP dependency URLs containing backslashes, whitespace or control characters are refused at validation. Copilot-family MCP configs are written atomically and owner-only, tightening an existing file before the write. Co-authored-by: Copilot App <[email protected]>
…egistry origin (#3649) RegistryConfig.headers_for(scheme, host) returns the registry bearer only when the request scheme and host equal the configured PROXY_REGISTRY_URL origin. Artifactory archive and entry downloads (explicit-FQDN dependencies and lockfile replays) request headers per target origin, so any other origin carries no registry credential. A registry token without a configured registry URL is no longer attached. Co-authored-by: Copilot App <[email protected]>
…3649) utils/http_credentials owns the credential header set (Authorization, PRIVATE-TOKEN) and removes it whenever a redirect leaves the original origin. The marketplace session and the no-netrc session reuse it, and token-bearing GitLab file downloads go through the no-netrc session. Registers the credential-origin-scope owner with its static guard, mutation case and lifecycle guard covering registry and GitLab origins. Co-authored-by: Copilot App <[email protected]>
… registry or overlays (#3649) MCPDependency.requires_transitive_trust marks self-defined entries and registry references that set their own registry URL or env, headers, args, url, command, cwd or extra keys. The MCP declaration-scope collectors gate transitive declarations on it, so such entries need --trust-transitive-mcp or re-declaration. Uninstall keeps only servers that were already managed, and update carries trust only for unchanged configs admitted earlier. The declaration-scope guard now requires the shared predicate. Co-authored-by: Copilot App <[email protected]>
…tories and destinations (#3649) Project target validation now covers every primitive deploy directory, and the shared collision check refuses a symlinked destination file, so install never writes through a linked path. Co-authored-by: Copilot App <[email protected]>
The scope-aware config_path_is_linked guard on the base adapter now covers project-scope Claude, Copilot, VS Code and Kiro config writes, and a skipped write is reported as a failed runtime. Co-authored-by: Copilot App <[email protected]>
Legacy skill cleanup leaves a symlinked skills root or skill entry untouched and removes directories through safe_rmtree; managed skill removal validates paths with validate_deploy_path. Co-authored-by: Copilot App <[email protected]>
…ories (#3649) apm unpack validates every destination before the first write, refuses paths outside known integration prefixes or through symlinks, and never reads bundle paths that run through a symlink. Co-authored-by: Copilot App <[email protected]>
…er (#3649) _get_token_for_host returns the AuthResolver token and yields no token when resolution fails, instead of reading GitHub token variables from the environment directly. Co-authored-by: Copilot App <[email protected]>
… URL (#3649) RegistryConfig.from_env reports once per process that the token is ignored without PROXY_REGISTRY_URL and names the variables to set. Docs state that the deprecated token applies only with a proxy URL. Co-authored-by: Copilot App <[email protected]>
…project (#3649) Co-authored-by: Copilot App <[email protected]>
… for deny matching (#3649) canonical_exec_identity lowercases identities whose host the host classification owner reports as GitHub-family or Azure DevOps, since those hosts resolve owner/repo case-insensitively. Other hosts stay exact. Co-authored-by: Copilot App <[email protected]>
… lifecycle policy check through outcome routing (#3649) policy_disabled_by_env in policy/discovery.py is the single reader of the documented APM_POLICY_DISABLE=1 switch for install, discovery and audit. The lifecycle-script org check resolves policy through route_discovery_outcome, so an outcome that blocks install, such as an unreachable policy with fetch_failure_default: block, also suppresses lifecycle scripts. Co-authored-by: Copilot App <[email protected]>
…servers (#3649) apm update accepts --trust-transitive-mcp through the same option apm install uses, and no longer treats MCP configs recorded in apm.lock.yaml as consent for transitive self-defined servers. The lockfile records what was written; trust comes only from the current run. Docs state that transitive self-defined servers are blocked and registry-resolved servers follow the documented registry flow. Co-authored-by: Copilot App <[email protected]>
…ile link guards (#3649) Co-authored-by: Copilot App <[email protected]>
Register install-deployment-policy-disable-switch-owner on the policy/ discovery.py owner record: discovery must define policy_disabled_by_env and read APM_POLICY_DISABLE exactly once, and no other source module may read the variable. Adds the frozen inventory entry and a sorted MutationCase. Co-authored-by: Copilot App <[email protected]>
…oot (#3649) Project-scope config writes are checked against the adapter's project root, so the test adapter now uses the temp directory its config path points to. Co-authored-by: Copilot App <[email protected]>
…3649) Uninstall without a lockfile no longer sweeps skill directories by package name at project or user scope; it keeps them and prints a notice. The unused name-based sweep helpers and their tests are removed. Co-authored-by: Copilot App <[email protected]>
…le (#3649) The merged hook config read moves to hook_ownership.read_merged_hook_config, which refuses a project config path that runs through a symlink before anything is read or written. Co-authored-by: Copilot App <[email protected]>
… consumer only (#3649) Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: hardening of existing install, update, uninstall and MCP trust boundaries; no OpenAPM v0.1 requirement changes Co-authored-by: Copilot App <[email protected]>
…cutables trust only for rebuilt survivors (#3649) The lifecycle runner reads the resolved org deny_all first, then routes the discovery outcome for fetch_failure_default. Uninstall and hook reintegration resolve the executables map only when survivors are rebuilt. Tests that exercised the retired lockfile-less skill sweep now pass recorded ownership, and the dev-MCP lifecycle passes per-run transitive consent to apm update. Co-authored-by: Copilot App <[email protected]>
…th main's approval keys (#3649) Shared (umask-mode) writes apply only to config files inside the project; configs a project install writes under the home directory stay owner-only. Tests now use the approval key apm approve writes and cover the lockfile- less skill cleanup no-op. Co-authored-by: Copilot App <[email protected]>
…ive directory links (#3649) Co-authored-by: Copilot App <[email protected]>
Lean panel (advisory) -- head c919933Personas: supply-chain-security-expert, test-coverage-expert, python-architect; apm-ceo synthesis. Recommendation: ship with follow-ups. No persona raised a blocking item.
Evidence
CEO synthesis. Every fix extends an existing canonical owner rather than adding a parallel authority. The rebase onto #3709 keeps main's single MCP-config link owner and its in-project file mode, so the two rounds do not disagree. Five user-facing behavior changes are listed under CHANGELOG Deferred follow-ups (non-blocking)
|
…s, before copying (#3649) Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Supply Chain Security Expert | 0 | 5 | 0 | Credentials, deploy roots and consent now stay in scope; same-origin header callers could migrate to headers_for(). |
| Test Coverage Expert | 0 | 3 | 0 | 11/11 CHANGELOG behavior changes have a revert-catching assertion; 14 lifecycle guards fail-before/pass-after. |
| Python Architect | 0 | 5 | 0 | No duplicated decision logic; merge resolutions in hook selection and uninstall keep each fix in its owner. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 5 follow-ups
- [Test Coverage Expert] Command-level
apm auditcase forAPM_POLICY_DISABLE=0-- the shared helper is unit-tested, but the audit call site is mocked. - [Python Architect] LSP dry-run preview should use the resolved executables map -- keeps
--dry-runoutput equal to what install deploys. - [Supply Chain Security Expert] Move same-origin
get_headers()callers toheaders_for()and consolidate the no-netrc session intoutils/http_credentials.py-- one audience check at the header source. - [Python Architect] Completeness test for the overlay fields that require transitive trust -- a new MCP field cannot silently skip the trust gate.
- [Test Coverage Expert] GitLab redirect through the download pipeline -- covers the session swap end to end.
Recommendation
Ship. CI is green at the head, and owner_touch_gate verify passes across 26 owner decisions. MCP audit omission evidence is tracked in #3720 for 0.36.0.
Full per-persona findings
Supply Chain Security Expert
- [recommended]
enterprise/security.mdtransitive section could list the registry/overlay triggers. - [recommended]
artifactory_resolver.py,marketplace/client.pyandartifactory_entry.pycallget_headers()for their own origin; migrate toheaders_for(). - [recommended]
resilient_get(allow_netrc=True)relies onrequestsstripping onlyAuthorization; route credential-bearing paths through the scoped session. - [recommended]
_NoNetrcSessionlives indeps/artifactory_entry.py; consolidate it withCredentialScopedSession. - [recommended] Comment why uninstall MCP cleanup intersects with managed servers.
Test Coverage Expert
- [recommended]
apm auditfail_on_driftwithAPM_POLICY_DISABLE=0at the command level. Proof (passed):tests/unit/policy/test_chain_discovery_shared.py::test_policy_disabled_by_env_accepts_only_the_documented_value - [recommended] GitLab redirect through
DownloadDelegate. Proof (passed):tests/unit/utils/test_http_credentials.py - [recommended] Policy fetch with an unavailable resolver at the integration level. Proof (passed):
tests/unit/policy/test_discovery_phase3w4.py
Python Architect
- [recommended]
install/dry_run_plan.pyreads the rawallowExecutablesfor the LSP preview. - [recommended] Add a boundary assertion for
ArtifactoryRegistryClient.get_headers(). - [recommended] Guard the one-shot
ARTIFACTORY_APM_TOKENwarning set with a lock. - [recommended] Test that
requires_transitive_trustcovers every non-structural MCP field. - [recommended] Verbose breadcrumb when uninstall drops a server that was not managed.
* fix(tests): restore arm64 integration lanes for 0.36.0 Gate run 44090072790 (main e9860ee) failed 27 Linux arm64 integration tests (19 also on macOS arm64), introduced by PRs that landed after the previous gate. PR CI never runs this corpus. Product regression, fixed: - On case-sensitive file systems a stale apm_modules/Test/C beside apm_modules/test/e made every repeat install fail ("Found multiple package directories"), and switching the declared casing failed with a false casing collision. Materialization now treats only two complete paths for one package as a collision and relocates into an existing case-variant owner directory (Refs #3698). Stale tests, updated to intentional behaviour changes: - #3672 (Refs #3649): stale-file removal needs a recorded hash (#3663); runtime-scoped MCP cleanup without marker dir (#3664); audit replays the install image (#3667); --frozen fails closed on edited skills (#3654); unverifiable marketplace ref is an error (#3670); architecture owner/semantic mutation matrix and audit.py re-anchor (#3659). - #3716 (Refs #3649): unpack writes only under managed integration dirs; registry token via headers_for(); raw-file fetch passes allow_netrc. - #3709: case-only user-file collisions branch on the actual file system (#3679, #3684); conflicted-lockfile path survives rich 80-col wrapping (#3695); a package and its own subdirectory package cannot both be declared (#3699). apm-spec-waiver: restores pre-existing install behaviour on case-sensitive file systems; no OpenAPM-observable change Co-authored-by: Copilot App <[email protected]> * fix(install): prune emptied source ancestors after cross-parent relocation Moving Test/C/packages/a beside test/c/packages/b on a case-sensitive file system left an empty Test/C tree that a later root dependency test/c counted as a second package directory. relocate_path now removes emptied source ancestors below apm_modules; rollback already recreates them via source.parent.mkdir(parents=True). apm-spec-waiver: restores pre-existing install behaviour on case-sensitive file systems; no OpenAPM-observable change Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: Copilot App <[email protected]>


Description
Hardening sweep for the 0.36.0 release. It tightens trust boundaries in install, update, uninstall, unpack, bundle install, MCP configuration and credential handling, so deployed content, credentials and consent decisions stay within their documented scope. Every change routes through an existing canonical owner (or promotes a private owner to a public one). Each owner change is protected by a lifecycle guard that fails on
mainand passes here.Hardened behavior:
drift.revision_pin_mismatch, replaces three inline copies.PROXY_REGISTRY_URLorigin.RegistryConfig.serves/headers_fordecide this.ARTIFACTORY_APM_TOKENwithout a proxy URL is ignored, with a warning.utils/http_credentials.pyowner.AuthResolver.apm unpackwrites only under managed integration directories.apm install <bundle>deploys only primitive files the target owns.--trust-transitive-mcp.apm updategains--trust-transitive-mcp, and the lockfile no longer carries transitive MCP consent.APM_POLICY_DISABLEis read by one helper and accepts only the documented1.deny_allcheck honorsfetch_failure_default.Behavior changes worth noting for users:
ARTIFACTORY_APM_TOKENwith noPROXY_REGISTRY_URL(orARTIFACTORY_BASE_URL) is no longer sent. SetPROXY_REGISTRY_URLandPROXY_REGISTRY_TOKEN.apm update, need--trust-transitive-mcp.apm uninstallwithout a lockfile no longer removes skill directories.APM_POLICY_DISABLEvalues other than1no longer disablefail_on_driftinapm audit.apm install <bundle>skips bundle files outside a target's primitive directories, with a warning.Issue and approved scope
Issue: Refs #3649
Human scope-approval comment: #3649 (comment) (0.36.0 pre-release sweep; maintainer directed a security-hardening round with private coordination).
Does this PR complete the issue, or what remains? No. This is the hardening part of the #3649 sweep. Deferred follow-ups: content-hash framing (needs a lockfile_version bump), hook frontmatter in skills/agents under the executables gate, and redirect handling for netrc and generic credential-helper lookups.
Type of change
Testing
Validation evidence (head of this branch, rebased on
mainf574a62):uvx [email protected] checkandformat --checkonsrc/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py: passed.python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ ...: 10.00/10.bash scripts/lint-auth-signals.sh: clean.bash scripts/lint-architecture-boundaries.sh: exit 0. File-length guard (2100): passed.tests/integration/test_*_lifecycle.py, listed below) withAPM_BINARY_PATH=.venv/bin/apm pytest -p no:xdist: 52 passed. Withsrc/reverted to the pre-change base: 39 failed and 13 passed (the 13 are positive controls).tests/unit/scripts,tests/integration/test_architecture_owner_rule_mutations.py): 1012 passed.New lifecycle guards:
test_executables_deny_identity,test_local_bundle_primitive_paths,test_lockfileless_skill_cleanup,test_mcp_credential_scope,test_package_mcp_executables_gate,test_registry_credential_origin,test_removal_reintegration_executables,test_revision_pin_lock_consistency,test_skill_cleanup_containment,test_symlinked_deploy_directory,test_symlinked_hook_settings,test_symlinked_mcp_config,test_unpack_destination_containment,test_update_transitive_mcp_trust(each*_lifecycle.py).Spec conformance (OpenAPM v0.1)
If this PR changes behaviour that an OpenAPM v0.1
req-XXXcovers,confirm the three-step ritual in the
development guide:
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
apm-spec-waiver: hardening of existing install, update, uninstall and MCP trust boundaries; no OpenAPM v0.1 requirement changes