Skip to content

fix: validate A2A version and extensions on all gRPC handler methods - #1042

Open
ez-lbz wants to merge 1 commit into
a2aproject:mainfrom
ez-lbz:fix/grpc-version-extension-validation
Open

fix: validate A2A version and extensions on all gRPC handler methods#1042
ez-lbz wants to merge 1 commit into
a2aproject:mainfrom
ez-lbz:fix/grpc-version-extension-validation

Conversation

@ez-lbz

@ez-lbz ez-lbz commented Aug 10, 2026

Copy link
Copy Markdown

What changed

1. Enforce A2A version and extension validation on all gRPC handler methods

Problem: In GrpcHandler, only sendMessage and sendStreamingMessage called A2AVersionValidator.validateProtocolVersion + A2AExtensions.validateRequiredExtensions. The remaining methods — getTask, listTasks, cancelTask, createTaskPushNotificationConfig, getTaskPushNotificationConfig, listTaskPushNotificationConfigs, subscribeToTask, deleteTaskPushNotificationConfig, getExtendedAgentCard — skipped validation entirely, so clients using an incompatible protocol version (or missing required extensions) were served instead of being rejected.

Fix (transport/grpc/src/main/java/org/a2aproject/sdk/transport/grpc/handler/GrpcHandler.java):

  • Added A2AVersionValidator.validateProtocolVersion(getAgentCardInternal(), context) and A2AExtensions.validateRequiredExtensions(getAgentCardInternal(), context) immediately after createCallContext(...) in all nine previously-unvalidated methods, mirroring the existing sendMessage/sendStreamingMessage pattern. For subscribeToTask the checks are placed after installForkedContextWrapper, matching sendStreamingMessage.

Fix (transport/grpc/src/test/java/org/a2aproject/sdk/transport/grpc/handler/GrpcHandlerTest.java):

  • Added testVersionNotSupportedErrorOnGetTask: a handler with an incompatible requested protocol version ("2.0" vs the card's "1.0") now fails getTask with gRPC UNIMPLEMENTED (mapped from VersionNotSupportedError). Previously getTask skipped validation and would have returned the task.

Behavior change: gRPC requests with an incompatible A2A-Version header or missing required extensions are now rejected on all methods instead of only the two streaming/unary message methods. Requests carrying no version header are unaffected (they default to "0.3" compatibility per spec, and validation passes when the card supports a compatible version).

Testing

  • mvn -pl transport/grpc test41 tests run, 0 failures, 0 errors, 0 skipped (BUILD SUCCESS), including the new regression test testVersionNotSupportedErrorOnGetTask.

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