Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

Commit

Permalink
0.9.7: Bugfixing validation
Browse files Browse the repository at this point in the history
This release fixes a validation bug introduced in the previous version where TLS parameters were validated even if the URL didn't point to a `https://` URL.
  • Loading branch information
Janos Pasztor committed Mar 6, 2021
1 parent eb3325e commit 7b2d246
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.7: Bugfixing validation

This release fixes a validation bug introduced in the previous version where TLS parameters were validated even if the URL didn't point to a `https://` URL.

## 0.9.6: Configurable TLS support, unified logging

This release adds configurable TLS versions, ciphers, ECDH curves, as well as transitioning to the unified logging interface.
Expand Down
18 changes: 10 additions & 8 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,16 @@ func (c *ClientConfiguration) Validate() error {
return err
}

if err := c.TLSVersion.Validate(); err != nil {
return fmt.Errorf("invalid TLS version (%w)", err)
}
if err := c.ECDHCurves.Validate(); err != nil {
return fmt.Errorf("invalid curve algorithms (%w)", err)
}
if err := c.CipherSuites.Validate(); err != nil {
return fmt.Errorf("invalid cipher suites (%w)", err)
if strings.HasPrefix(c.URL, "https://") {
if err := c.TLSVersion.Validate(); err != nil {
return fmt.Errorf("invalid TLS version (%w)", err)
}
if err := c.ECDHCurves.Validate(); err != nil {
return fmt.Errorf("invalid curve algorithms (%w)", err)
}
if err := c.CipherSuites.Validate(); err != nil {
return fmt.Errorf("invalid cipher suites (%w)", err)
}
}

return c.validateClientCert()
Expand Down

0 comments on commit 7b2d246

Please sign in to comment.