Repository navigation
Python: Fix DevUI authentication for non-ASCII bearer tokens - #10354
Draft
Patel Namraa (Namraa310806) wants to merge 2 commits into
Draft
Patel Namraa (Namraa310806) wants to merge 2 commits into
Patel Namraa (Namraa310806) wants to merge 2 commits into
Conversation
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
November 14, 2026 02:38 — with
GitHub Actions
Active
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
November 14, 2026 02:38 — with
GitHub Actions
Active
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
November 14, 2026 02:38 — with
GitHub Actions
Active
This branch was successfully deployed
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.
Motivation & Context
DevUI currently returns HTTP 500 when a non-ASCII bearer token is supplied because
secrets.compare_digest()raises aTypeErrorwhen comparing non-ASCII strings.This should be handled as an authentication mismatch rather than an internal server error.
This change proposes a consistent encoding contract for bearer-token authentication between the bundled frontend and the backend, while preserving existing ASCII-token behavior.
Description & Review Guide
What are the major changes?
secrets.compare_digest()with Latin-1 encoding.httpx.ASGITransportto exercise exact header bytes.ApiClientsource through Vite, uses nativefetch(), and communicates with a live Uvicorn-hosted DevUI server.What is the impact of these changes?
secrets.compare_digest()on bytes.What do you want reviewers to focus on?
Related Issue
Related to #9713.
This is a draft implementation submitted to facilitate discussion of the proposed Latin-1 wire contract. Maintainer confirmation of the encoding approach is still pending. I would appreciate feedback on the contract before treating this PR as ready for review.
AI Assistance
AI assistance details:
AI assistance was used to help prepare and open the draft PR, refine and polish the PR description, discuss the implementation approach, review the code, identify and investigate edge cases, develop regression tests, and analyze test results. I independently reviewed the changes, verified the implementation, and ran the relevant validation checks. I understand the submitted changes and accept responsibility for them.
Contribution Checklist
Validation performed:
DEVUI_WIRE_TEST=1 pytest test_bearer_auth_wire.py— 3 passed.pytest test_server.py -k "bearer_token or token_matches"— 14 passed.Note:
test_devui_streaming_renderer_memory_is_boundedalso fails locally on unmodifiedmain.