Repository navigation
feat(http): add support for X-Warpgate-Ticket header - #2751
Open
JulioRamos0 wants to merge 3 commits into
Open
JulioRamos0 wants to merge 3 commits into
JulioRamos0 wants to merge 3 commits into
Conversation
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.
Description
This PR adds support for passing target tickets via the custom
X-Warpgate-TicketHTTP header, in addition to the existingAuthorization: Warpgate <ticket>header and?warpgate-ticket=<ticket>query parameter.Motivation & Problem
When proxying requests to an upstream target that requires its own HTTP authentication (such as
Authorization: Basic <credentials>or upstream bearer tokens), a conflict arises. According to RFC 7235 / RFC 9110, HTTP requests cannot reliably carry multipleAuthorizationheaders—most HTTP clients, libraries, and reverse proxies merge, overwrite, or reject requests with duplicateAuthorizationheaders.Because of this collision:
Authorization: Warpgate <ticket>overrides the target'sAuthorization: Basic ...header.?warpgate-ticket=...) is often undesirable for security or caching reasons (URLs get logged in access logs, referrers, and browser histories).Introducing
X-Warpgate-Ticket: <ticket>resolves this conflict cleanly, allowing clients to authenticate against Warpgate while preserving the standardAuthorizationheader for the upstream target.Changes:
warpgate-common/warpgate-common-http: Defined and re-exportedX_WARPGATE_TICKET(x-warpgate-ticket). As anx-warpgate-*header, it is automatically stripped before forwarding requests upstream viamay_forward_header.warpgate-protocol-http: UpdatedTicketMiddlewareto check forX-Warpgate-TicketifAuthorization: Warpgateis not present, instantiating the temporary session identically to the existing header.warpgate-web: Updated connection instructions in the web UI to display theX-Warpgate-Ticketheader option alongside theAuthorizationheader.tests: Added e2e test assertion intest_http_user_auth_ticket.pyverifying successful target access usingX-Warpgate-Ticket.AI Usage
Choose the level of AI involvement for this PR.
This is not to block AI contributions but rather to speed up PR review (saves time on trying to deduce the logic behind AI hallucinations).