feat(governance): cross-organizational federation governance model (#93)#343
feat(governance): cross-organizational federation governance model (#93)#343ArokyaMatthew wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…icrosoft#93) Adds mutual policy enforcement, org-level trust, and policy delegation for cross-organizational agent interactions. New module: agentmesh.governance.federation - OrgPolicy: organization-scoped policy documents with rules - OrgTrustAgreement: bilateral trust agreements between orgs - PolicyDelegation: category-scoped governance delegation - FederationEngine: mutual enforcement (caller + callee checked) - InMemoryFederationStore / FileFederationStore: persistence layer - PolicyCategory enum: extensible governance taxonomy Changes: - Add ORGANIZATION scope to PolicyScope (AGENT > ORG > TENANT > GLOBAL) - Update _SCOPE_SPECIFICITY in both conflict_resolution implementations - Export federation types from agentmesh.governance Tests: 49 new tests covering mutual enforcement, trust agreements, delegations, blocklists, fail-closed semantics, expiration, constraints, ORGANIZATION scope ranking, and edge cases. All 79 existing governance tests pass with zero regressions.
|
Welcome to the Agent Governance Toolkit! Thanks for your first pull request. |
|
@imran-siddique , please review. |
imran-siddique
left a comment
There was a problem hiding this comment.
Impressive work @ArokyaMatthew — this is a solid federation governance implementation with good architecture, fail-closed semantics, and 49 tests. Three things to fix before merge:
1. \datetime.utcnow()\ deprecated (blocking): This is deprecated in Python 3.12+ and will be removed. Replace all instances with:
\\python
from datetime import timezone
datetime.now(timezone.utc) # instead of datetime.utcnow()
\\
2. Missing error handling in \FileFederationStore._load()\ (blocking): File I/O has no try-except — corrupt YAML, permission errors, or missing files will crash silently. Wrap in try-except with logging:
\\python
try:
with open(yaml_file) as f:
policy = OrgPolicy.from_yaml(f.read())
except (OSError, yaml.YAMLError) as e:
logger.error('Failed to load policy from %s: %s', yaml_file, e)
continue
\\
3. No tests for \FileFederationStore\ (blocking): 49 tests but zero coverage on the file-based store. Please add tests using \ mp_path\ for: valid YAML loads, invalid YAML fails gracefully, missing directory doesn't crash.
Nice to have (non-blocking):
- Add org_id format validation (^[a-zA-Z0-9_-]+$)
- Document that policy YAML files must be admin-controlled (not user-editable)
The mutual enforcement model (most restrictive wins), bilateral trust agreements, and ORGANIZATION scope integration are all well-designed. Looking forward to the updated PR.
PR microsoft#357 (ExecutionSandbox) introduced subprocess.run(command, shell=True) which is the EXACT CWE-78 command injection vulnerability we fixed in MSRC Case 111178. Also a stub with no real isolation logic. PR microsoft#362 (OrgPolicy/FederatedEnforcement) has a dangerous default-allow policy (return True for all trusted org requests) and duplicates the comprehensive federation system in PR microsoft#343. Both PRs placed files in src/governance/ which is outside our package structure (all code lives under packages/). Removing orphaned files. Existing implementations: - Sandboxing: packages/agent-runtime/ (4 execution rings, real isolation) - Federation: packages/agent-mesh/ (PR microsoft#343 has 1774-line implementation) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(esrp): update NuGet signing config with Client ID and Key Vault (#365) Align NuGet ESRP signing steps with PyPI/npm pipeline config: - Client ID: a458522c-0359-4e92-9887-5fee1607c0c7 - Key Vault: learncopilot - Remove ESRP_AAD_SECRET (no longer SFI-compliant) - Add CP-401405 key code reference TODO: Activate once PRSS certs are generated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(security): move all ESRP config to secrets — no plaintext in pipelines Remove Client ID, Key Vault name, cert names, and email addresses from pipeline YAML files. All values now sourced from pipeline variables/secrets (ADO) or GitHub Secrets (GHA). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * revert: remove unsafe merged PRs #357 and #362 PR #357 (ExecutionSandbox) introduced subprocess.run(command, shell=True) which is the EXACT CWE-78 command injection vulnerability we fixed in MSRC Case 111178. Also a stub with no real isolation logic. PR #362 (OrgPolicy/FederatedEnforcement) has a dangerous default-allow policy (return True for all trusted org requests) and duplicates the comprehensive federation system in PR #343. Both PRs placed files in src/governance/ which is outside our package structure (all code lives under packages/). Removing orphaned files. Existing implementations: - Sandboxing: packages/agent-runtime/ (4 execution rings, real isolation) - Federation: packages/agent-mesh/ (PR #343 has 1774-line implementation) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks @ArokyaMatthew — this is a substantial contribution for #93. CI is showing 5 failures (API compatibility check + AI code review). Could you:
Happy to review once CI is green. This is great work — just needs the rebase to land cleanly. |
Summary
Implements cross-organizational federation governance as described in #93. Adds mutual policy enforcement, org-level trust agreements, and policy delegation for cross-organizational agent interactions.
Zero breaking changes — federation is a new additive module alongside the existing governance engine.
Problem
AgentIdentity has organization and
organization_idfields but they are never used in policy enforcement. All governance is callee-only — there is no mutual enforcement, no org-scoped policy delegation, and no concept of "org A trusts org B's governance layer."What's New
Core Module:
agentmesh.governance.federationpii_handling,data_export,cost_control, etc.)Scope Hierarchy Update
Added
ORGANIZATIONscope to PolicyScope enum in bothagent-osandagentmeshconflict resolution:Files Changed
ORGANIZATIONscopeORGANIZATIONscope (fallback)Test Results
Design Decisions
outputs:-


Closes #93