Skip to content

fix(keycardai-oauth): preserve authorization endpoint query parameters - #372

Draft
Kayvan-Zahiri wants to merge 1 commit into
keycardai:mainfrom
Kayvan-Zahiri:codex/preserve-authorization-endpoint-query
Draft

Kayvan-Zahiri wants to merge 1 commit into
keycardai:mainfrom
Kayvan-Zahiri:codex/preserve-authorization-endpoint-query

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

build_authorize_url appends ? unconditionally, so an authorization endpoint such as https://auth.example.com/authorize?tenant=acme becomes ...?tenant=acme?response_type=code&.... The tenant value changes and response_type is missing as a separate query parameter. A trailing empty ? similarly produces ??response_type=code.

Split the endpoint and append encoded OAuth parameters to its existing query component. Preserve existing parameter order, percent-encoding and blank values without decoding/re-encoding them. Endpoints without an existing query retain their usual output. This follows RFC 6749 section 3.1, which requires retaining an authorization endpoint's existing query when adding parameters.

Add three public-builder cases (tenant query, encoded/blank parameters, empty query) and one public begin_authorization case using supplied authorization-server metadata. They verify tenant routing, OAuth fields, repeated resources and PKCE state/challenge. All four fail on the original source and pass after the fix; no browser or server is needed for these new regressions.

Validation:

  • Full OAuth suite: 569 passed, no skips or failures, including local HTTP/Unix-socket fixture tests.
  • Full workspace ruff check, OAuth-source ty check, changed-file Ruff formatting and git diff --check: pass using the committed lock and declared tools.

Other package test suites, the separate FastMCP environment, full seven-package typecheck, hosted authorization and platform/Python matrices were not run. No browser, hosted credentials or production login was used. No dependencies, generated files or lockfiles change. Developed with Codex assistance and reproduced locally.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant