Skip to content

Implement Zero Trust Mandate Enforcement for A2A Transfers#20

Open
dcplatforms wants to merge 1 commit into
mainfrom
feat/a2a-zero-trust-refactor-17556814814901887395
Open

Implement Zero Trust Mandate Enforcement for A2A Transfers#20
dcplatforms wants to merge 1 commit into
mainfrom
feat/a2a-zero-trust-refactor-17556814814901887395

Conversation

@dcplatforms

Copy link
Copy Markdown
Owner

This PR implements the "Last Line of Defense" security principle for Agent-to-Agent (A2A) transfers in the OCP SDK.

Key changes:

  1. Architectural Integrity: A2AService now strictly adheres to the repository pattern by using db.findAgentById instead of direct model imports.
  2. Zero Trust Security: All A2A transfers now support (and require in strict mode) a signed AP2 Mandate. The MandateService has been enhanced to validate not only the cryptographic signature but also the transaction context (budget and recipient authorization) during the verification process.
  3. Robustness: AgentService.performA2ATransfer has been hardened to handle missing configuration objects gracefully, preventing runtime errors on legacy records.
  4. Consistency: Error messages across the SDK now consistently use the "Zero Trust Validation Failed: " prefix for policy and mandate violations.
  5. Testing: Introduced tests/unit/a2a.spec.js and expanded tests/unit/agent.spec.js to cover the new security flows and edge cases.

These changes ensure that OCP is not just moving money, but moving authorized intent, backed by a verifiable "Chain of Evidence."


PR created automatically by Jules for task 17556814814901887395 started by @dcplatforms

- Refactor `A2AService` to use repository pattern and `MandateService` for Zero Trust validation.
- Update `executeTransfer` to accept and verify mandates with transaction context.
- Refine `AgentService` for consistent policy enforcement and graceful `config` handling.
- Enhance `MandateService.verifyMandate` with contextual budget and recipient validation.
- Standardize "Zero Trust Validation Failed: " error prefixing across core services.
- Update `src/index.js` for correct `A2AService` initialization.
- Add comprehensive unit tests for A2A transfers and policy enforcement.

Co-authored-by: dcplatforms <10982057+dcplatforms@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant