Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ require this path, and rewrite the imports.
The repository was renamed from `pgsty/minio-pkg` on 2026-08-02. GitHub redirects
the old path, but pin the new one.

## Go and TLS compatibility

The library retains its Go 1.26 floor and is also tested with Go 1.27. Runtime
defaults depend on the consuming application's Go version and `GODEBUG`, not
just this library's `go.mod`. The web-environment client leaves TLS key exchange
at Go defaults; LDAP and OIDC helpers also preserve caller-supplied TLS settings.
For default-configured TLS, `GODEBUG=tlsmlkem=0` disables hybrid key exchanges;
`GODEBUG=tlssecpmlkem=0` disables only the SecP hybrids and retains X25519MLKEM768.
These settings preserve certificate verification.

On macOS, applications targeting Go 1.27 replace Keychain trust with on-disk
roots and Go's verifier when either `SSL_CERT_FILE` or `SSL_CERT_DIR` is set.
Stale or incomplete CA paths can break previously trusted connections; unset
inherited values to restore Keychain trust. Explicit CAs supplied to
`certs.GetRootCAs` remain additive to the selected root pool.
An application still targeting Go 1.26 retains the
old platform default unless it opts in with
`GODEBUG=x509sslcertoverrideplatform=1`. The Windows loader in this package reads
the Windows ROOT store directly and is unchanged. See the
[Go release notes](https://go.dev/doc/go1.27).

## Versioning

Tags follow upstream's numbering so it is obvious which release a version is
Expand Down
50 changes: 50 additions & 0 deletions env/web_env_tls_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (c) 2026 Pigsty
// SPDX-License-Identifier: AGPL-3.0-or-later

package env

import (
"crypto/tls"
"crypto/x509"
"io"
"net/http"
"net/http/httptest"
"slices"
"strings"
"testing"
)

func TestWebEnvTLSKeyExchangeDefaults(t *testing.T) {
for _, debug := range []string{"tlsmlkem=0", "tlsmlkem=1"} {
t.Run(debug, func(t *testing.T) {
t.Setenv("GODEBUG", debug)
hellos := make(chan []tls.CurveID, 1)
server := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_, _ = io.WriteString(w, "lab-value")
}))
server.TLS = &tls.Config{GetConfigForClient: func(hello *tls.ClientHelloInfo) (*tls.Config, error) {
select {
case hellos <- slices.Clone(hello.SupportedCurves):
default:
}
return nil, nil
}}
server.StartTLS()
defer server.Close()
roots := x509.NewCertPool()
roots.AddCert(server.Certificate())
previousRoots := globalRootCAs
RegisterGlobalCAs(roots)
t.Cleanup(func() { RegisterGlobalCAs(previousRoots) })
endpoint := "env+tls://local:" + strings.Repeat("x", 64) + "@" + server.Listener.Addr().String()
value, _, _, err := getEnvValueFromHTTP(endpoint, "lab-key")
if err != nil || value != "lab-value" {
t.Fatalf("value %q, error %v", value, err)
}
curves := <-hellos
if got, want := slices.Contains(curves, tls.X25519MLKEM768), debug == "tlsmlkem=1"; got != want {
t.Errorf("ML-KEM offered = %v, want %v; curves %v", got, want, curves)
}
})
}
}