Skip to content

connection credentials origin#22040

Closed
icing wants to merge 2 commits into
curl:masterfrom
icing:ntlm-negotiate-creds-origin
Closed

connection credentials origin#22040
icing wants to merge 2 commits into
curl:masterfrom
icing:ntlm-negotiate-creds-origin

Conversation

@icing

@icing icing commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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).

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).
@icing icing requested a review from bagder June 16, 2026 10:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_origin to track which origin the connection-bound credentials apply to.
  • Unlink/free creds_origin with 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.

Comment thread lib/url.c
Comment thread lib/http_negotiate.c
- make auth_nego reuse check same as ntlm check
- http_negotiate: link peer/creds only on success
@icing icing requested a review from bagder June 16, 2026 11:12
@bagder bagder closed this in bd10924 Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants