You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mcp): org mcp.trust_transitive admits transitive MCP servers only through mcp.allow - #4827
When the effective org policy sets mcp.trust_transitive: false, or leaves it unset while any other field is non-default, an MCP server declared by a dependency at depth > 1 is admitted only when mcp.allow lists it. This applies to registry references, servers pinned with apm approve, and --trust-transitive-mcp alike. Projects with no org policy, a policy that sets no field ("present but empty"), or --no-policy are unchanged.
Activation.mcp.trust_transitive is tri-state: None when absent, effectively false. An explicit value counts as a set field (discovery._is_policy_empty), so trust_transitive: false alone activates the rule, while a policy that states nothing keeps the present-but-empty outcome.
enforcement: block.McpAdmission.refuses_transitive (security/trust.py) runs before the pin, opt-in and registry rungs and withholds the server with reason policy-transitive. refuse_policy_transitive (install/mcp/integration.py) then stops the install before any write, naming mcp.trust_transitive and mcp.allow.
enforcement: warn. This matches mcp.deny: the server deploys, and the merged direct-plus-transitive preflight warns. That preflight is install/commit_gate.py (run_policy_preflight over policy_subject_mcp_deps), which raises only under block. The new check mcp-trust-transitive in policy_checks.mcp_policy_checks sits beside mcp-denylist there.
apm audit --ci. It reports mcp-trust-transitive for every transitive server outside mcp.allow: deployed servers through mcp_policy_checks over the audit view, and withheld servers through the view's policy-transitive omissions.
Spec. req-sc-016 is revised in place as proposed amendment 0.1.76 (direction signed by the CEO). The requirements manifest note is updated, a @pytest.mark.req("req-sc-016") test is added, and CONFORMANCE is regenerated.
Issue and approved scope
Issue: hardening follow-up (scope approved by the maintainers).
Human scope-approval comment: scope approved by the program lead and the Quality & Lifecycle owner.
Does this PR complete the issue, or what remains? It completes it.
Type of change
Bug fix
New feature
Documentation
Maintenance / refactor
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Lifecycle cells by QL W3b in tests/lifecycle/scenarios/test_policy_promises.py (G1): flag, approved and registry paths for both refuse and audit, the no-policy and allow-list controls, and the activation rows (explicit false alone; default under another field; defaults-only stays present-but-empty). Red-first CI: 45073041873, 45072818470, 45073540289. The xfail marks are removed. The approved path pins the server before the policy applies, because the policy now refuses the pre-approval install. The G2 content_types rows are left to their own change.
host_guard pytest -n 2 over test_policy_promises G1, tests/unit/policy, tests/unit/install/test_mcp_preflight_policy.py and tests/spec_conformance/test_portable_mcp_approval_reqs.py: all green after updating the check counts (21 to 22, MCP 4 to 5) and regenerating the policy golden (trust_transitive false to null).
Lint mirror: ruff check and format, pylint R0801, auth-signal lint, complexity ratchet, taxonomy --changed, architecture boundaries, assertion ratchet, 2100-line guard and changelog fragments are all clean.
Changelog
One fragment per section, changelog.d/<pr>.<section>.md, holding
one line: user-visible effect first, 25 words or fewer, ending with (#PR); breaking changes only under upgrade notes; no Highlights; no
new lines under ## [Unreleased]. See changelog.d/README.md and .github/instructions/changelog.instructions.md.
…ough mcp.allow (req-sc-016)
When the effective org policy sets mcp.trust_transitive to false, or leaves
it unset under any other non-default field, a server declared by a
dependency at depth > 1 deploys only when mcp.allow lists it. A registry
reference, an approval pin and --trust-transitive-mcp all go through the
same rung in McpAdmission; under enforcement: block the install stops
before writing. An explicit trust_transitive value now counts as a set
field, so a policy that states nothing stays present-but-empty.
Lifecycle cells from QL W3b (test_policy_promises.py G1).
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The transitive-policy checks incorrectly enforce restrictions in off mode, mishandle legacy caches and dry runs, and leave lifecycle and golden-snapshot tests failing.
This PR adds an organization-policy check to MCP admission so transitive servers cannot bypass mcp.trust_transitive: false through registry references, approval pins, or one-run trust flags.
Changes:
Adds policy-based admission refusal and blocks installs before deployment under blocking enforcement.
Distinguishes an omitted trust_transitive field from an explicit value.
Adds lifecycle controls and refusal cases; audit coverage remains marked as expected failure pending S2.
…sc-016)
- apm audit --ci reports each transitive MCP server outside mcp.allow while
mcp.trust_transitive is false (check mcp-trust-transitive), whether the
server was withheld or deployed before the policy applied.
- enforcement: warn matches mcp.deny: the server deploys and the merged-set
preflight warns; enforcement: block withholds it and fails the install.
- req-sc-016 revised in place (proposed amendment 0.1.76); CONFORMANCE
regenerated; upgrade note in changelog.d.
- Lifecycle G1 cells: the approved path pins the server before the policy
applies; the audit rows lose their xfail marks.
Co-authored-by: Copilot App <[email protected]>
…pth (req-sc-016)
The mcp-trust-transitive check classified every dependency-declared server
as transitive (resolved_by is set for direct dependencies too). It now
reads MCPDependency.declared_depth, set by the MCP view from the lock
depth, and judges depth > 1 only, as McpAdmission.subject does. A direct
dependency's server installs and passes audit under the rule
(test_a_direct_dependency_server_is_not_transitive, red before this).
Co-authored-by: Copilot App <[email protected]>
Frozen install ignores --no-policy during hydrated MCP validation
src/apm_cli/security/trust.py:326
The hydrated frozen-install caller in install/phases/integrate.py:824-830 supplies trust_context but not ctx.no_policy; this branch now discovers org policy again instead of using only that context. Consequently, apm install --frozen --no-policy can pass initial validation but fail hydrated MCP validation under an org transitive restriction. Pass no_policy=ctx.no_policy at that caller and add a frozen-install regression so both checks honor the option.
- install --dry-run previews a trust_transitive refusal as 'Would be
blocked by policy' and never raises; the real install still stops.
- Policy cache schema 7: schema 6 serialized an omitted trust_transitive
as false, so its entries are invalidated.
- A transitive native Claude plugin's MCP servers meet the same rule:
native admission and gate retirement pass the declaring depth.
- req-sc-016 wording: a root re-declaration is the project's own direct
server, judged by the direct mcp checks; (b) and (c) never override.
- Cells: dry-run preview (red before), root re-declaration under mcp.deny,
native plugin depth, pre-upgrade cache invalidation (red before).
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical gap allows approved transitive native plugins with unmodeled MCP bundles to bypass a policy disabling transitive trust, permitting deployment in block mode and producing no diagnostic in warn mode.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Transitive native plugins with unmodeled MCP bundles can bypass a policy that only sets mcp.trust_transitive: false, allowing admission without an mcp.allow match or policy diagnostic.
…p.trust_transitive
An MCP bundle APM cannot read cannot show it is in mcp.allow, so under
org mcp.trust_transitive false a transitive native plugin that ships one
fails closed (parked under block, warned under warn), as it already does
for any other restricting MCP rule (req-sc-016).
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unpublished findings reveal inconsistent transitive-policy enforcement across install, audit, and native-plugin paths, requiring human assessment of policy ownership, bypass handling, and empty-policy exemptions.
…ecks
The merged audit runs one more manifest check; the three compilation checks
share one fail-fast exit, so the function stays within the return limit.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unpublished findings reveal policy-handling and diagnostic inconsistencies across native plugins and frozen installs that require human assessment of their combined impact.
…t predicate
Admission and the mcp-trust-transitive check share transitive_server_listed()
in security/trust.py. A server listed in both mcp.allow and mcp.deny is now
reported by the deny check, not as missing from mcp.allow.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because an unpublished finding shows the audit recommends approval for an already-approved server blocked by organization policy, which approval cannot override.
Two lifecycle cells: install refuses before any write and audit --ci fails,
both naming mcp.deny. The eligibility parity test moves to the unit-tier
policy checks module.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because policy refusals receive ineffective approval guidance, while documentation and implementation disagree on when transitive restrictions activate.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Transitive MCP restrictions can be bypassed during Codex registration and missed by native-plugin audits, while the specification misstates policy activation and diagnostics recommend ineffective approval.
- A transitive Codex compatibility plugin's servers need mcp.allow under
mcp.trust_transitive false: block refuses before registration, warn
diagnoses.
- audit --ci reports a locked transitive Claude native plugin's servers
that mcp.allow does not list, and any MCP entry APM cannot read.
- config-consistency names the policy fields, not an approval, for a server
org mcp.trust_transitive withholds.
- req-sc-016 activation is defined by restrictions; metadata and
enforcement alone are not restrictions.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The policy audit misses unlisted MCP servers in deployed depth-2 Codex bundles under a blocking policy, and warning diagnostics omit additional violating servers.
The Codex trust_transitive diagnostic (warn) and refusal (block) list each
server mcp.allow does not list, not only the first.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because findings omitted from the published review identify inconsistent native-plugin policy enforcement and incomplete warn-mode diagnostics.
The one-off --trust-transitive-mcp notice lives beside the approval helpers in
security/trust.py, keeping install/mcp/integration.py within its LOC budget.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because omitted findings reveal a critical frozen-install policy-bypass regression and incomplete warning diagnostics for transitive native-plugin MCP servers.
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
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
When the effective org policy sets
mcp.trust_transitive: false, or leaves it unset while any other field is non-default, an MCP server declared by a dependency at depth > 1 is admitted only whenmcp.allowlists it. This applies to registry references, servers pinned withapm approve, and--trust-transitive-mcpalike. Projects with no org policy, a policy that sets no field ("present but empty"), or--no-policyare unchanged.mcp.trust_transitiveis tri-state:Nonewhen absent, effectively false. An explicit value counts as a set field (discovery._is_policy_empty), sotrust_transitive: falsealone activates the rule, while a policy that states nothing keeps the present-but-empty outcome.enforcement: block.McpAdmission.refuses_transitive(security/trust.py) runs before the pin, opt-in and registry rungs and withholds the server with reasonpolicy-transitive.refuse_policy_transitive(install/mcp/integration.py) then stops the install before any write, namingmcp.trust_transitiveandmcp.allow.enforcement: warn. This matchesmcp.deny: the server deploys, and the merged direct-plus-transitive preflight warns. That preflight isinstall/commit_gate.py(run_policy_preflightoverpolicy_subject_mcp_deps), which raises only under block. The new checkmcp-trust-transitiveinpolicy_checks.mcp_policy_checkssits besidemcp-denylistthere.apm audit --ci. It reportsmcp-trust-transitivefor every transitive server outsidemcp.allow: deployed servers throughmcp_policy_checksover the audit view, and withheld servers through the view'spolicy-transitiveomissions.@pytest.mark.req("req-sc-016")test is added, and CONFORMANCE is regenerated.Issue and approved scope
Issue: hardening follow-up (scope approved by the maintainers).
Human scope-approval comment: scope approved by the program lead and the Quality & Lifecycle owner.
Does this PR complete the issue, or what remains? It completes it.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Lifecycle cells by QL W3b in
tests/lifecycle/scenarios/test_policy_promises.py(G1): flag, approved and registry paths for both refuse and audit, the no-policy and allow-list controls, and the activation rows (explicit false alone; default under another field; defaults-only stays present-but-empty). Red-first CI: 45073041873, 45072818470, 45073540289. The xfail marks are removed. The approved path pins the server before the policy applies, because the policy now refuses the pre-approval install. The G2content_typesrows are left to their own change.host_guard pytest -n 2over test_policy_promises G1,tests/unit/policy,tests/unit/install/test_mcp_preflight_policy.pyandtests/spec_conformance/test_portable_mcp_approval_reqs.py: all green after updating the check counts (21 to 22, MCP 4 to 5) and regenerating the policy golden (trust_transitivefalse to null).Lint mirror: ruff check and format, pylint R0801, auth-signal lint, complexity ratchet, taxonomy
--changed, architecture boundaries, assertion ratchet, 2100-line guard and changelog fragments are all clean.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
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.