Skip to content

server: let the authentication handler authenticate a connection itself - #7

Merged
Stebalien merged 1 commit into
masterfrom
steb/tls-auth
Nov 5, 2026
Merged

Stebalien merged 1 commit into
masterfrom
steb/tls-auth

Conversation

@Stebalien

@Stebalien Stebalien commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

For mTLS auth, we need authenticate the connection itself without checking user provided creds. This PR adds the hook we need to so that.


Note

Medium Risk
Changes the server authentication handshake order and can bypass password checks when a handler opts in, which is security-sensitive though backward compatible for handlers that do not implement the new interface.

Overview
Adds an optional ConnectionAuthenticator extension to AuthenticationHandler, so implementations can accept a client from the connection itself (e.g. TLS client certificate) after the handshake response and TLS upgrade, before credential lookup and password verification.

The handshake path in readHandshakeResponse type-asserts the handler and, when AuthenticateConnection returns true, finishes reading connect attributes and returns success without running handleAuthMatch / compareAuthData. OnAuthSuccess and the OK packet behave as for normal auth. Returning false keeps the existing password flow unchanged.

Connect-attribute parsing is extracted into readConnectAttributes and used in both branches. A new integration test uses a handler that accepts any TLS client cert and otherwise requires password secret.

Reviewed by Cursor Bugbot for commit 2df2331. Bugbot is set up for automated code reviews on this repo. Configure here.

@Stebalien
Stebalien merged commit b3cc99e into master Nov 5, 2026
44 checks passed
@Stebalien
Stebalien deleted the steb/tls-auth branch November 5, 2026 19:35
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.

2 participants