Skip to content

[v2] Validate state in the OAuth callback server - #10889

Open
aemous wants to merge 1 commit into
v2from
agent-registry-upstream
Open

aemous wants to merge 1 commit into
v2from
agent-registry-upstream

Conversation

@aemous

@aemous aemous commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Description of changes:

  • When a caller passes expected_state to AuthCodeFetcher.get_auth_code_and_state, OAuthCallbackHandler only ends the wait on a GET /oauth/callback whose state matches (constant time compare). Other paths get 404; a missing or wrong state gets 400, and the wait continues.

Description of tests:

  • Ran and passed all CI (see GitHub Actions).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

When a caller passes expected_state to
AuthCodeFetcher.get_auth_code_and_state, OAuthCallbackHandler only
ends the wait on a GET /oauth/callback whose state matches (constant
time compare). Other paths get 404, a missing or wrong state gets 400,
and the wait continues. Each connection gets _REQUEST_TIMEOUT, and the
authorization server's error and error_description are kept in
AuthCodeFetcher.error.

aws sso login and aws login now pass their state. The server also logs
handler errors, such as a browser disconnecting early, at debug
instead of printing a traceback.
@aemous
aemous requested a review from a team as a code owner November 11, 2026 21:45
@aemous aemous added the v2 label Nov 11, 2026
@aemous
aemous requested a review from ashovlin November 11, 2026 22:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants