Skip to content

Feat/tlsconfig#49

Merged
hyp3rd merged 3 commits intomainfrom
feat/tlsconfig
Jan 13, 2026
Merged

Feat/tlsconfig#49
hyp3rd merged 3 commits intomainfrom
feat/tlsconfig

Conversation

@hyp3rd
Copy link
Owner

@hyp3rd hyp3rd commented Jan 13, 2026

No description provided.

- 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.
Copilot AI review requested due to automatic review settings January 13, 2026 13:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/tlsconfig package 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.
Copy link
Contributor

Copilot AI commented Jan 13, 2026

@hyp3rd I've opened a new pull request, #50, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Jan 13, 2026

@hyp3rd I've opened a new pull request, #51, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Jan 13, 2026

@hyp3rd I've opened a new pull request, #52, to work on those changes. Once the pull request is ready, I'll request review from you.

@hyp3rd hyp3rd merged commit 503fb63 into main Jan 13, 2026
29 checks passed
@hyp3rd hyp3rd deleted the feat/tlsconfig branch January 13, 2026 19:14
@hyp3rd hyp3rd restored the feat/tlsconfig branch January 16, 2026 11:40
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