Skip to content

fix(a2a): enforce trusted invocation redirect origins - #36

Merged
Larry-Osakwe merged 3 commits into
mainfrom
devin/spec-157-a2a-redirect-origin
Nov 26, 2026
Merged

Larry-Osakwe merged 3 commits into
mainfrom
devin/spec-157-a2a-redirect-origin

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

DelegationClient checks 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-retryable A2aDiscoveryException naming the redirect origin and target, with no request to the redirect origin. An allowed redirect is not followed and raises A2aInvocationException.

  • Builder#httpClient and Builder#transport(KeycardHttpTransport.of(client)) reject a JDK client whose redirect policy is ALWAYS or NORMAL (configuration error at build time), so the bearer can never be forwarded by the client itself.
  • JdkHttpTransport (keycard-oauth) inspects the redirect status and Location before consuming the body, so an oversized or malformed body on an untrusted redirect still yields the origin refusal.
  • Other custom KeycardHttpTransport implementations 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=plain on JDK 17, 21, 25: BUILD SUCCESSFUL.
  • examples/mcp-server-servlet, examples/a2a-delegation, examples/mcp-server-spring-ai selftests on all three JDKs: pass.
  • Release tooling unittest (33 tests), check-drift, commit validation, cz check --message: pass.

Notes

  • Rows 17 and 18 take the spec's "return invocation error without following" option.
  • The change touches KeycardHttpTransport and JdkHttpTransport in keycard-oauth, because the transport owns the client and body stream; the PR is squash-merged as one fix(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

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@Larry-Osakwe
Larry-Osakwe marked this pull request as ready for review November 26, 2026 02:37
@Larry-Osakwe
Larry-Osakwe requested a review from a team as a code owner November 26, 2026 02:37
@devin-ai-integration

devin-ai-integration Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
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>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

…ers first

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No new blocking issues. 1 optional suggestion (a nit or a note on pre-existing code) was found and not posted. Nothing in this review needs a push before merging.

@Larry-Osakwe Larry-Osakwe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good.

@Larry-Osakwe
Larry-Osakwe merged commit 46989d8 into main Nov 26, 2026
17 checks passed
@Larry-Osakwe
Larry-Osakwe deleted the devin/spec-157-a2a-redirect-origin branch November 26, 2026 03:03
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.

2 participants