Skip to content

Add validation for maxVersion below minimum allowed TLS version#52

Closed
Copilot wants to merge 1 commit intofeat/tlsconfigfrom
copilot/sub-pr-49-another-one
Closed

Add validation for maxVersion below minimum allowed TLS version#52
Copilot wants to merge 1 commit intofeat/tlsconfigfrom
copilot/sub-pr-49-another-one

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

The TLS config validation was checking if maxVersion < minVersion but not validating whether an explicitly set maxVersion is below the minimum allowed version (TLS 1.3). This allowed invalid configurations like WithMaxVersion(tls.VersionTLS10) to pass validation.

Changes

  • Add validation in validateCommonConfig to reject maxVersion values below tlsDefaultMinVersion (TLS 1.3) when explicitly set
  • Maintain existing behavior where maxVersion = 0 means "no maximum" and is allowed
  • Add test cases covering the new validation logic
// Before: This would pass validation incorrectly
config, _ := New(
    WithMinVersion(tls.VersionTLS13),
    WithMaxVersion(tls.VersionTLS10), // TLS 1.0 < TLS 1.3 but wasn't caught
)

// After: Returns ErrTLSVersionTooLow
config, err := New(
    WithMinVersion(tls.VersionTLS13),
    WithMaxVersion(tls.VersionTLS10), // Now properly rejected
)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Jan 13, 2026
Copilot AI changed the title [WIP] WIP address feedback from review on TLS config implementation Add validation for maxVersion below minimum allowed TLS version Jan 13, 2026
Copilot AI requested a review from hyp3rd January 13, 2026 15:55
@hyp3rd hyp3rd closed this Jan 13, 2026
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