Skip to content

fix: reject blank organization before actor resolution in session transfer token request - #150

Merged
nandan-bhat merged 3 commits into
mainfrom
fix/stt-organization-validation-and-docs
Aug 5, 2026
Merged

fix: reject blank organization before actor resolution in session transfer token request#150
nandan-bhat merged 3 commits into
mainfrom
fix/stt-organization-validation-and-docs

Conversation

@kishore7snehil

Copy link
Copy Markdown
Contributor

📋 Changes

This PR moves 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. It also corrects the Session Transfer Token section of examples/CustomTokenExchange.md where the docs described behavior that did not match the implementation or the platform.

🔧 API Changes

  • request_session_transfer_token now rejects a blank (empty or whitespace-only) organization with InvalidArgumentError before 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 in build_session_transfer_redirect.

📖 Documentation

  • organization on the mint is sent on the token exchange request, not forwarded to the redirect; corrected the inline comment that said otherwise
  • The actor-token crypto requirement now states it applies when actor_token_type is the ID token URN (the default), and lists the aud-must-match-this-client and user-still-exists-and-not-blocked checks
  • The redirect organization is 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

  • This change adds test coverage
  • This change has been tested on the latest version of the platform/language

Contributor Checklist

…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.
@kishore7snehil
kishore7snehil requested a review from a team as a code owner August 5, 2026 13:47
nandan-bhat
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
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
nandan-bhat merged commit ba0a2a5 into main Aug 5, 2026
9 checks passed
@nandan-bhat
nandan-bhat deleted the fix/stt-organization-validation-and-docs branch August 5, 2026 14:46
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