Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the tls min version to dsn #736

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

zhiyunliu
Copy link

add the tls min version to dsn parameter.
we can use [tlsminversion=tls1.1] to set tls version.
the dsn like this .(server=localhost;port=1433;database=demo;user id=admin;password=123456;tlsminversion=tls1.3)

#726

@codecov
Copy link

codecov bot commented Apr 19, 2022

Codecov Report

Merging #736 (9ec1344) into master (e538731) will increase coverage by 1.28%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #736      +/-   ##
==========================================
+ Coverage   71.29%   72.57%   +1.28%     
==========================================
  Files          24       24              
  Lines        5386     5397      +11     
==========================================
+ Hits         3840     3917      +77     
+ Misses       1301     1234      -67     
- Partials      245      246       +1     
Impacted Files Coverage Δ
tds.go 74.55% <100.00%> (+8.69%) ⬆️
token.go 63.77% <0.00%> (-0.45%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e538731...9ec1344. Read the comment docs.

tds.go Outdated
@@ -1150,7 +1150,7 @@ initiate_connection:
}
}
if config == nil {
config, err = msdsn.SetupTLS("", false, p.Host)
config, err = msdsn.SetupTLS("", false, p.Host, 0)
Copy link
Author

Choose a reason for hiding this comment

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

I try to many way add the test case . but no one can cover this line.

@zhiyunliu
Copy link
Author

Does anyone care about this problem?

@shueybubbles
Copy link
Contributor

You can clone the issue and the PR into github.com/microsoft/go-mssqldb. We are going to maintain a fork there.

if ok {
tlsversion = strings.ToUpper(tlsversion)
switch tlsversion {
case "TLS1.0":
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just "1.0" and "1.2" etc since we already know the parameter name is about TLS?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zhiyunliu we'd consider taking this change in the microsoft fork
github.com/microsoft/go-mssqldb

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