fix: reject blank organization before actor resolution in session transfer token request - #150
Merged
Merged
Conversation
…nsfer token request Move the blank-organization check in request_session_transfer_token ahead of actor resolution, so a request that cannot succeed no longer refreshes and persists the agent session first. Matches the up-front check already in build_session_transfer_redirect. Also correct the Session Transfer Token section of CustomTokenExchange.md: organization on the mint is sent on the exchange request (not forwarded to the redirect); the actor-token crypto requirement applies when actor_token_type is the ID token URN and now lists the aud and user-status checks; and the redirect organization is not conditional on how the STT was minted.
nandan-bhat
previously approved these changes
Aug 5, 2026
…n transfer token Add tests that organization is forwarded onto the mint request and omitted when absent, and rewrite the blank-organization test to set up an expired session and assert the refresh, state-store write, and token request are all skipped - proving the check runs before actor resolution.
nandan-bhat
previously approved these changes
Aug 5, 2026
… and simplify blank-org test Add the InvalidArgumentError case to the Raises docstring, matching build_session_transfer_redirect. Drop the dead side_effect on the _is_id_token_usable mock in the blank-org ordering test - the guard fires before it is ever consumed.
nandan-bhat
approved these changes
Aug 5, 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.
📋 Changes
This PR moves the blank-
organizationcheck inrequest_session_transfer_tokenahead of actor resolution, so a request that cannot succeed no longer refreshes and persists the agent session first. It also corrects the Session Transfer Token section ofexamples/CustomTokenExchange.mdwhere the docs described behavior that did not match the implementation or the platform.🔧 API Changes
request_session_transfer_tokennow rejects a blank (empty or whitespace-only)organizationwithInvalidArgumentErrorbefore the actor is resolved, so an expired agent session ID token is no longer refreshed and re-persisted on a request that cannot succeed. This matches the up-front check already inbuild_session_transfer_redirect.📖 Documentation
organizationon the mint is sent on the token exchange request, not forwarded to the redirect; corrected the inline comment that said otherwiseactor_token_typeis the ID token URN (the default), and lists theaud-must-match-this-client and user-still-exists-and-not-blocked checksorganizationis no longer described as conditional on how the STT was minted; pass it when you want the target login org-scoped, the same as any other org-scoped login🧪 Testing
Contributor Checklist