fix: Port branch-scoped auth responses and OAuth2 nonce forwarding to v1 - #6803
Merged
Conversation
Port of the same fix on main. The auth preprocessor read the whole session event list when looking for the adk_request_credential call that a credential response belongs to. During a parallel or delegated execution, a credential returned for one branch matched the pending request on a sibling branch, and the preprocessor re-executed that branch's tool. It now reads invocation_context._get_events(current_branch=True), so only events on the current branch, plus the user's own events, are considered. The user's credential reply carries no branch and stays visible everywhere, so an ordinary same-branch resume is unaffected. Behaviour change: an adk_request_credential response no longer resumes a tool whose auth request was issued on a different branch. On v1 branches are compared for equality rather than by prefix, so this also covers a request issued on a branch below the current one; a test pins that boundary.
Port of the same fix on main. OAuth2Auth already has a nonce field, described as the value that binds the user's session to the authorization request, but generate_auth_uri never put it in the query parameters it hands to create_authorization_url. A caller who set a nonce got an authorization request without one, so the returned id_token could not be bound to it and the OIDC replay defence was silently absent. The nonce is now passed through when the credential carries one, alongside the audience parameter that is handled the same way. Flows that leave it unset are unchanged.
wukath
approved these changes
Aug 19, 2026
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.
This PR ports two auth changes from
mainto thev1branch.fix: use branch-scoped events for auth responses(f706a1ec)adk_request_credentialresponse againstpending requests on the current branch only, plus the user's branchless
events.
a tool only in that branch. Same-branch resume is unaffected.
fix: forward the OAuth2 nonce to the authorization request(79cc1f29)generate_auth_uriforwardsOAuth2Auth.nonceinto the authorizationrequest when the credential carries one.
nonceunset produce a byte-identical request.