Skip to content

fix: Port branch-scoped auth responses and OAuth2 nonce forwarding to v1 - #6803

Merged
GWeale merged 2 commits into
v1from
backport-v1-pr13
Aug 19, 2026
Merged

fix: Port branch-scoped auth responses and OAuth2 nonce forwarding to v1#6803
GWeale merged 2 commits into
v1from
backport-v1-pr13

Conversation

@GWeale

@GWeale GWeale commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

This PR ports two auth changes from main to the v1 branch.

  1. fix: use branch-scoped events for auth responses (f706a1ec)

    • The auth preprocessor matches an adk_request_credential response against
      pending requests on the current branch only, plus the user's branchless
      events.
    • Behaviour change, no opt-out: a credential returned in one branch resumes
      a tool only in that branch. Same-branch resume is unaffected.
    • Credential storage stays session-wide.
  2. fix: forward the OAuth2 nonce to the authorization request (79cc1f29)

    • generate_auth_uri forwards OAuth2Auth.nonce into the authorization
      request when the credential carries one.
    • Callers that leave nonce unset produce a byte-identical request.

GWeale added 2 commits August 17, 2026 23:01
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.
@GWeale
GWeale merged commit 5817d30 into v1 Aug 19, 2026
14 checks passed
@GWeale
GWeale deleted the backport-v1-pr13 branch August 20, 2026 00:04
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.

3 participants