fix: decline SSL negotiation in plaintext mode
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 5m7s
Test and Release PawSQL / test (push) Successful in 44s
Test and Release PawSQL / release (push) Successful in 10s

This commit is contained in:
2026-09-15 22:28:16 -04:00
parent e67698f3c2
commit cae9419cd5
4 changed files with 125 additions and 2 deletions

View File

@@ -145,6 +145,14 @@ func (s *Server) handle(connection net.Conn) {
resolveContext, cancelResolve := context.WithTimeout(context.Background(), resolveTimeout)
defer cancelResolve()
if s.TLSConfig == nil {
negotiated, negotiateErr := pgwire.NegotiatePlainPostgreSQL(connection)
if negotiateErr != nil {
s.Logger.Warn("connection rejected", "remote_address", remote, "result", "invalid_negotiation", "error", negotiateErr)
return
}
proxyClient = negotiated
}
if sni != "" {
backend, err = s.Resolver.Resolve(resolveContext, sni)
if err != nil {