Repository navigation
fix(a2a): enforce trusted invocation redirect origins - #36
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Larry-Osakwe
marked this pull request as ready for review
November 26, 2026 02:37
Contributor
Author
Devin Review🟢 Devin Review found nothing to fix · View findings · Follow Devin's work |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ers first Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DelegationClientchecks the origin of a redirect returned by a token-bearing invocation before any body is read. A disallowed origin, including HTTPS to HTTP on the same host, raises the non-retryableA2aDiscoveryExceptionnaming the redirect origin and target, with no request to the redirect origin. An allowed redirect is not followed and raisesA2aInvocationException.Builder#httpClientandBuilder#transport(KeycardHttpTransport.of(client))reject a JDK client whose redirect policy isALWAYSorNORMAL(configuration error at build time), so the bearer can never be forwarded by the client itself.JdkHttpTransport(keycard-oauth) inspects the redirect status andLocationbefore consuming the body, so an oversized or malformed body on an untrusted redirect still yields the origin refusal.KeycardHttpTransportimplementations are opaque; their Javadoc states they must not follow redirects.Implements keycardai/keycard-sdk-spec#157 (a2a-delegation v5 rows 16, 17, 18, 19).
Refs SDK-103.
Tests
./gradlew build publishToMavenLocal --console=plainon JDK 17, 21, 25: BUILD SUCCESSFUL.examples/mcp-server-servlet,examples/a2a-delegation,examples/mcp-server-spring-aiselftests on all three JDKs: pass.check-drift, commit validation,cz check --message: pass.Notes
KeycardHttpTransportandJdkHttpTransportinkeycard-oauth, because the transport owns the client and body stream; the PR is squash-merged as onefix(a2a)release since all modules ship together.Link to Devin session: https://app.devin.ai/sessions/758806b9fb514b6f9c65afd93ca8faa0
Open in Devin Desktop: https://app.devin.ai/desktop/session/758806b9fb514b6f9c65afd93ca8faa0?variant=devin