connection credentials origin#22040
Closed
icing wants to merge 2 commits into
Closed
Conversation
When tying credentials to a connection (NTLM, Negotiate) also link the origin the credentials are for. This prevents a connection reuse with the same credentials, but intended for another origin. The mis-reuse could happen for a forwarding proxy and NTLM (although, in the mind of the person writing this, it is an insane setup).
bagder
approved these changes
Jun 16, 2026
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent incorrect connection reuse when authentication mechanisms (notably NTLM and Negotiate/SPNEGO) bind credentials to a connection, by additionally binding the origin those credentials are intended for. This addresses a potential mis-reuse scenario with forwarding proxies where the same proxy connection could otherwise be reused for a different origin while still carrying connection-bound auth state.
Changes:
- Add
conn->creds_originto track which origin the connection-bound credentials apply to. - Unlink/free
creds_originwith the connection and when resetting auth state. - Enforce origin+creds matching for NTLM connection reuse and bind origin when NTLM/Negotiate ties creds to the connection.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/urldata.h | Adds creds_origin to struct connectdata to track the origin associated with connection-bound credentials. |
| lib/url.c | Unlinks creds_origin on connection free; updates NTLM connection-reuse matching to also check creds_origin; links creds_origin when setting connection-level creds. |
| lib/http_ntlm.c | Clears creds_origin/creds on NTLM handshake rejection; binds origin+creds when NTLM ties credentials to the connection. |
| lib/http_negotiate.c | Clears creds_origin when resetting Negotiate; binds origin+creds when Negotiate ties credentials to the connection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- make auth_nego reuse check same as ntlm check - http_negotiate: link peer/creds only on success
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.
When tying credentials to a connection (NTLM, Negotiate) also link the origin the credentials are for. This prevents a connection reuse with the same credentials, but intended for another origin.
The mis-reuse could happen for a forwarding proxy and NTLM (although, in the mind of the person writing this, it is an insane setup).