Skip to content

feat: APS-AgentMesh adapter — structural authorization gates#598

Open
aeoess wants to merge 5 commits intomicrosoft:mainfrom
aeoess:feat/aps-agentmesh-adapter
Open

feat: APS-AgentMesh adapter — structural authorization gates#598
aeoess wants to merge 5 commits intomicrosoft:mainfrom
aeoess:feat/aps-agentmesh-adapter

Conversation

@aeoess
Copy link
Copy Markdown
Contributor

@aeoess aeoess commented Mar 30, 2026

APS-AgentMesh Integration

Responds to @imran-siddique's invitation in #478.

Bridges Agent Passport System (APS) structural authorization into AGT's PolicyEngine as external trust signals.

What this PR adds

packages/agentmesh-integrations/aps-agentmesh/ — a new integration package with:

Component Purpose
APSPolicyGate Injects APS PolicyDecision into AGT evaluate(action, context)
APSTrustBridge Maps APS passport grades (0-3) to AGT trust scores (0-1000)
APSScopeVerifier Validates APS delegation scope chains for task assignment
aps_context() Builds AGT-compatible context dict from APS artifacts

Architecture

APS governs between processes (cryptographic proof of authorization scope). AGT governs inside the process (policy evaluation, trust scoring). APS structural authorization = hard constraint (gate). AGT behavioral trust = soft signal.

AGT policy rule example

- name: require-aps-authorization
  type: capability
  conditions:
    aps_decision.verdict: 'permit'
  allowed_actions:
    - 'deploy.*'

Tests

17 tests covering: decision parsing, scope chain validation, trust bridging, policy gate context building, scope verification (prefix match, wildcard, depth, budget), and AGT context shape compatibility.

Next steps from #478

  1. ✅ Draft PR with minimal APS adapter (this PR)
  2. Define interface contract for consuming APS PolicyDecision artifacts
  3. Add cross-verification tests using shared decision artifact format
  4. Map Entity Verification v1.0 to did:agentmesh: DID scheme

APS: aeoess.com | SDK v1.29.1 (1,919 tests) | MCP v2.19.0 (125 tools) | Paper

aeoess added 3 commits March 15, 2026 14:58
…agents

Bridges APS (Agent Passport System) structural authorization into AGT's
PolicyEngine as external trust signals.

Components:
- APSPolicyGate: inject APS PolicyDecision into AGT evaluation context
- APSTrustBridge: map APS passport grades (0-3) to AGT trust scores (0-1000)
- APSScopeVerifier: validate APS delegation scope chains for task assignment
- aps_context(): build AGT-compatible context dict from APS artifacts
- verify_aps_signature(): Ed25519 signature verification

Architecture:
  APS governs BETWEEN processes (cryptographic proof of authorization scope)
  AGT governs INSIDE the process (policy evaluation, trust scoring)
  APS structural authorization = hard constraint (gate)
  AGT behavioral trust = soft signal (modifies score, doesn't override gate)

17 tests. Zero dependencies (APS SDK optional for full signature verification).

Responds to: microsoft#478 (imran-siddique invitation)
APS: https://aeoess.com | npm: agent-passport-system v1.29.1 (1,919 tests)
@github-actions github-actions bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file tests size/XL Extra large PR (500+ lines) labels Mar 30, 2026
Copy link
Copy Markdown
Member

@imran-siddique imran-siddique left a comment

Choose a reason for hiding this comment

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

Architecturally sound adapter — clean separation of APS hard gates vs AGT soft signals. One blocking issue:

Critical: Signature verification silently degrades to format-only check
\�erify_aps_signature()\ falls back to accepting any 128-char hex string when PyNaCl is absent. Since
acl\ is not in required dependencies, the default install always uses this insecure path. Must fail closed:
\\python
except ImportError:
return False # Cannot verify without nacl
\\

Also:

  • Pin \�gent-passport-system>=0.7.0,<0.8.0\ (unbounded external dep)
  • Remove unused \hashlib\ and \ ime\ imports
  • Add input validation on \passport_grade\ (invalid values silently accepted)
  • Trim promotional content in README to match style of other integration packages
  • Add tests for \�erify_aps_signature\ (the critical path has zero coverage)

Good work overall — the fail-closed defaults on APSDecision and the zero-dep core are well done.

1. CRITICAL: verify_aps_signature now fails closed when PyNaCl absent
   (returns False instead of accepting any 128-char hex string)
2. Pin agent-passport-system>=0.7.0,<0.8.0
3. Remove unused hashlib and time imports
4. Add input validation on passport_grade (ValueError on invalid)
5. Trim promotional content in README (minimal links section)
6. Add 5 tests for verify_aps_signature and passport_grade validation

22 tests passing.
@aeoess
Copy link
Copy Markdown
Contributor Author

aeoess commented Apr 2, 2026

@imran-siddique — all six items addressed in e7f8423. Thank you for the thorough review.

1. CRITICAL (fail closed): verify_aps_signature() now returns False when PyNaCl is absent. No more format-only fallback.

2. Pinned dep: agent-passport-system>=0.7.0,<0.8.0

3. Unused imports: Removed hashlib and time.

4. passport_grade validation: aps_context() raises ValueError on invalid grades (must be 0, 1, 2, or 3).

5. README trimmed: Replaced promotional section with minimal links.

6. Tests added: 5 new tests covering verify_aps_signature (fail-closed without nacl, bad signature, empty inputs) and passport_grade validation (invalid value, negative value). 22 total passing.

…coverage

Address remaining review feedback from @imran-siddique:
- README: remove architectural positioning, add install section, match
  Microsoft integration package style
- Tests: add valid signature, wrong key, and tampered data coverage for
  verify_aps_signature (25 tests total)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aeoess
Copy link
Copy Markdown
Contributor Author

aeoess commented Apr 4, 2026

@imran-siddique — all six points addressed across two commits (e7f8423 + f8d4ea5):

  1. verify_aps_signature fail-closedreturn False on ImportError. No silent degradation.
  2. Dep pinnedagent-passport-system>=0.7.0,<0.8.0
  3. Unused imports removedhashlib and time cleaned up
  4. passport_grade validationValueError for values outside 0-3
  5. README trimmed — removed architectural positioning language, added install section, matches integration package style
  6. 3 new signature tests (25 total): valid roundtrip, wrong key rejects, tampered data rejects. All require PyNaCl — skip gracefully when absent.

The fail-closed fix was the right call. Format-only verification creates false confidence — worse than no verification.

@aeoess
Copy link
Copy Markdown
Contributor Author

aeoess commented Apr 4, 2026

@imran-siddique — just checking if the two fix commits (e7f8423 + f8d4ea5) address everything from your review. Happy to adjust if any points need further work.

Copy link
Copy Markdown
Member

@imran-siddique imran-siddique left a comment

Choose a reason for hiding this comment

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

All 6 review items verified as addressed:

  1. verify_aps_signature() now returns False on ImportError (fail-closed)
  2. agent-passport-system pinned to >=0.7.0,<0.8.0
  3. Unused hashlib/time imports removed
  4. passport_grade validated with ValueError
  5. README promotional content trimmed
  6. Signature verification tests added (6 tests)

Clean architecture, good test coverage (25 tests), zero required dependencies. LGTM.

Note: PR is still in Draft — please mark as Ready for Review to proceed with merge.

@aeoess aeoess marked this pull request as ready for review April 5, 2026 03:38
@aeoess
Copy link
Copy Markdown
Contributor Author

aeoess commented Apr 5, 2026

@imran-siddique — thank you for the thorough review. Marked as ready.

One follow-up after merge: the dep pin is currently >=0.7.0,<0.8.0. We shipped v0.8.0 today with BYOI interop (did:key, SPIFFE, OAuth, VC wrapper). Happy to open a follow-up PR bumping to >=0.8.0 once this lands — the interop modules let the AGT adapter bridge to external identity systems without custom code.

@imran-siddique imran-siddique self-assigned this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/XL Extra large PR (500+ lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants