Skip to content

fix(types): preserve securitySchemes and oneof fields in fromJSON codecs - #664

Open
Varun-S10 wants to merge 1 commit into
a2aproject:mainfrom
Varun-S10:fix/issue-663
Open

fix(types): preserve securitySchemes and oneof fields in fromJSON codecs#664
Varun-S10 wants to merge 1 commit into
a2aproject:mainfrom
Varun-S10:fix/issue-663

Conversation

@Varun-S10

Copy link
Copy Markdown
Contributor

Description

What does this PR do?

Fixes an issue where canonicalizeAgentCard() dropped securitySchemes when passed an AgentCard instance.

Why is this needed?

Protobuf oneof fields in TypeScript instances use the { scheme: { $case, value } } format. SecurityScheme.fromJSON and OAuthFlows.fromJSON previously expected only raw ProtoJSON object keys (like openIdConnectSecurityScheme), so passing an AgentCard instance caused securitySchemes to be silently dropped during canonicalization. This caused signature verification to fail when signing with AgentCard.fromJSON() and verifying with plain JSON, and broke cross-SDK verification with Python.

What changes were made?

  • Updated SecurityScheme.fromJSON to accept both external ProtoJSON format and internal {$case, value} representations.
  • Updated OAuthFlows.fromJSON with the same {$case, value} support.
  • Added comprehensive unit tests in test/types/security_schemes.spec.ts and regression tests in test/signature.spec.ts.

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests and linter pass
  • Appropriate docs were updated (if necessary)

Fixes #663 🦕

@Varun-S10
Varun-S10 requested a review from a team as a code owner August 20, 2026 05:47
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

No coverage changes.

Generated by coverage-comment.yml

@bartek-gralewicz

Copy link
Copy Markdown
Contributor

The file src/types/pb/a2a.ts should not be modified manually. It is an automatically generated file. The first line in that file clearly states "DO NOT EDIT".

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

Labels

None yet

Projects

None yet

2 participants