Merged
Conversation
- Add pkg/tlsconfig with NewClientConfig/NewServerConfig APIs - Secure defaults: TLS 1.2+ with curated ciphers/curves; TLS13-only opt - Options: min/max version, ciphers, curves, ALPN, SNI, Root/Client CAs, certificates, GetCertificate/GetClientCertificate, ClientAuth, InsecureSkipVerify (explicit), KeyLogWriter - Validation: version range, cipher/curve sets; require server cert; require ClientCAs for mTLS - Errors: ErrInvalidTLSConfig, ErrTLSVersionTooLow, ErrTLSVersionRange, ErrTLSMissingCertificate, ErrTLSInvalidCipherSuites, ErrTLSInvalidCurvePreferences, ErrTLSMissingClientCAs - Tests cover defaults, TLS13Only, invalid configs, and mTLS requirements - Docs: README and docs/* updated with usage examples and security checklist - Chore: cspell.json extended for TLS/mTLS terms
Introduce WithPostQuantumKeyExchange() to opt-in to hybrid PQ key exchange
by prepending tls.X25519MLKEM768 to CurvePreferences for TLS 1.3. Peers
without support gracefully negotiate X25519. Curve order updated to prefer
{X25519MLKEM768, X25519, P256, P384}.
- tlsconfig: implement option and adjust curve-preference logic
- tests: add TestClientConfigPostQuantum to verify preference order
- docs: update README, usage guide, and security checklist with PQ guidance
- spelling: add mlkem and quantum to cspell dictionary
- deps: bump golang.org/x/crypto to v0.47.0 and golang.org/x/net to v0.49.0
No breaking changes; feature is opt-in and limited to TLS 1.3 handshakes.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces a new pkg/tlsconfig package that provides opinionated, secure-by-default TLS configurations for both client and server use cases. The package enforces TLS 1.2+ with curated cipher suites, supports mTLS, and offers optional hybrid post-quantum key exchange (X25519MLKEM768).
Changes:
- Added new
pkg/tlsconfigpackage with client/server config builders and validation - Updated dependencies: golang.org/x/crypto to v0.47.0 and golang.org/x/net to v0.49.0
- Extended documentation in README.md, docs/usage.md, and docs/security-checklist.md with examples and security guidance
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/tlsconfig/doc.go | Package documentation for the new tlsconfig package |
| pkg/tlsconfig/errors.go | Error definitions for TLS configuration validation |
| pkg/tlsconfig/config.go | Core implementation with NewClientConfig/NewServerConfig and option functions |
| pkg/tlsconfig/config_test.go | Test suite covering defaults, validation, and configuration options |
| go.mod | Updated golang.org/x/crypto and golang.org/x/net dependencies |
| go.sum | Updated checksums for dependency changes |
| docs/usage.md | Added comprehensive usage documentation with examples |
| docs/security-checklist.md | Added TLS configuration guidance |
| README.md | Added TLS configuration examples to main documentation |
| cspell.json | Added TLS-related terms to spell check dictionary |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Default min version set to TLS 1.3 (tlsDefaultMinVersion = tls.VersionTLS13). - Validation now rejects minVersion below the default, effectively enforcing a TLS 1.3 floor. - Server configs unconditionally set PreferServerCipherSuites: true; internal preferServerCipherSuites field removed. - Scoped gosec exceptions: replace //nolint:gosec with targeted // #nosec G402 on MinVersion and InsecureSkipVerify. - Minor internal struct cleanup (no functional change beyond the above). Impact: - Endpoints limited to TLS 1.2 will fail to negotiate. - Lowering below TLS 1.3 is rejected by validateCommonConfig; use TLS 1.3 or update endpoints accordingly. - To pin strictly to TLS 1.3, use WithTLS13Only(). BREAKING CHANGE: TLS 1.2 is no longer supported by default and cannot be selected via options; the minimum is enforced at TLS 1.3.
Contributor
Contributor
Contributor
bf79426 to
fbd7576
Compare
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.
No description provided.