-
Notifications
You must be signed in to change notification settings - Fork 303
Update Encrypt
property default value to true
#1210
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
Update Encrypt
property default value to true
#1210
Conversation
What issue is this solving? |
Doesn't this require the server to have proper SSL certificates? If so, that seems quite breaking for everyone currently happily not using SSL in internal networks... |
It depends on the value of TrustServerCertificate see https://docs.microsoft.com/en-us/sql/relational-databases/native-client/features/using-encryption-without-validation?view=sql-server-ver15 by default default is to trust the server so default configuration self signed will still allow access. EnableEncryption just forces the use of ssl and doesn't have implications for client or server certificate validation. |
This is all about the client environment configuration and possible security breaches. Also, the customers who enforce the encryption on the server don't face this breach. |
Are you sure about that? Both that table and checking the default value of SqlConnectionStringBuilder.TrustServerCertificate seem to indicate that self-signed certificates aren't trusted by default, and one has to opt in explicitly by setting |
Any connection to the server at least needs a secure login that means both sides of the connection should be possible to encrypt. So, If one side wasn't able to encrypt, establishing a secure connection shouldn't be possible. Regarding the use of |
Comment's updated. |
Ok. but I think the point was to ask why the change is being made. Is it a top down decision to require encryption at all times? |
It includes two changes:
If you asked for Encrypt default value, the quick answer is yes. But if you asked for the encryption process, I delegate it to @David-Engel. |
There are two issues being addressed here:
|
Thanks, makes sense doing this for version 4! |
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserSafeHandles.cs
Outdated
Show resolved
Hide resolved
LGTM. I wait for other teammate opinion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor suggestions.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Cheena Malhotra <v-chmalh@microsoft.com>
Someone mentioned that TrustServerCertificate defaults to true. That is incorrect, unless that was also changed for this driver. |
Okay, so if the change is only for Microsoft.Data.SqlClient, then that is understandable. If System.Data and ODBC/OLE DB are unchanged, then I do not have any objection to that.
I was just worried that legacy apps might get caught up in the change.
From: David Engel ***@***.***>
Sent: Thursday, August 19, 2021 7:20 PM
To: dotnet/SqlClient ***@***.***>
Cc: Malcolm Stewart ***@***.***>; Comment ***@***.***>
Subject: Re: [dotnet/SqlClient] Update `Encrypt` property default value to true (#1210)
Someone mentioned that TrustServerCertificate defaults to true. That is incorrect, unless that was also changed for this driver.
I suspect they misspoke. I confuse TrustServerCertificate all the time, thinking of it as "validate server certificate" in my head.
When Encrypt=true, then the certificate is also validated.
This means that changing the default will break many scenarios.
With Encrypt=False, SSL/TLS is still used to encrypt the login packet, but the certificate is not validated.
Correct. That will still be the case.
With Encrypt=true, SSL/TLS is used to encrypt the login packet and all subsequent packets, but the certificate is validated first.
With the default TrustServerCertificate value, correct.
Systems using SQL Server's self-generated certificate will fail after this change and the user will have to buy a certificate or create a self-signed certificate, or change their connection string. If the change was made for scenarios where the user could not modify the connection string to enable encryption, then they are left having to get new certificates.
Given that applications must be on Microsoft.Data.SqlClient to get this change, that means the application is almost certainly under current development. I don't think there is high risk that someone will be blocked by not being able to change the Encrypt setting for an application that is under current development. If their application is truly stuck, they will likely be on System.Data.SqlClient or an earlier version of MDS forever. Additionally, if this argument continues to keep us from making the change, it will never be made and security will never improve. We do understand it may be disruptive, but security has been pushing for us to do this for years.
-
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2FSqlClient%2Fpull%2F1210%23issuecomment-902315002&data=04%7C01%7CMalcolm.Stewart%40microsoft.com%7C5763d8d8eb1e4addb78c08d96367ddea%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637650120065312533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Eb1l18h%2FD9UkwGRydX8JlVPfqcV6oL4ovB1gDJjCDIE%3D&reserved=0>, or unsubscribe<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPBDW7CXNLXHSSRNKJQKEGLT5WGSBANCNFSM5CCTGNWA&data=04%7C01%7CMalcolm.Stewart%40microsoft.com%7C5763d8d8eb1e4addb78c08d96367ddea%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637650120065312533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=w41RG5AbH8m3pnkjkLU5JTdjtnbagLjTV%2BwuxQP%2FQh4%3D&reserved=0>.
Triage notifications on the go with GitHub Mobile for iOS<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CMalcolm.Stewart%40microsoft.com%7C5763d8d8eb1e4addb78c08d96367ddea%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637650120065322527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DOA4596Zr93Rk0LIQpmPUqygzqpld4LNuvAh0JvM5mc%3D&reserved=0> or Android<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26utm_campaign%3Dnotification-email&data=04%7C01%7CMalcolm.Stewart%40microsoft.com%7C5763d8d8eb1e4addb78c08d96367ddea%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637650120065322527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=fsrF13LR3xh16UCkldxL87%2FwH3zvVlQOwx%2F0NtZMkMo%3D&reserved=0>.
|
This caused downtime for our production Logic Apps talking to SQL as we are using self-signed SSL certs on SQL and hadn't declared trustservercertificates. I am 100% onboard with the change I just wish this had been communicated to users of Logic Apps for example. We have no ability/visibility to track potential changes like this via the underlying Logic Apps stack, we rely on Microsoft to surface and communicate breaking changes in advance, it's clear from this issue that this was known to be a breaking change before it was merged. I assume as this was merged a year ago but we only experienced the change a couple of weeks ago that Logic Apps have only just updated to this version of dotnet. |
We have experienced this same type of issue during testing of our own apps which utilise the Serilog MSSQL sink - had it not been for the fact that their changelog included the breaking change link for this lib we would've been in a bit of a pickle, so appreciate both ends declaring this - although it perhaps highlights the need for our end to look deeper into checking dependencies of dependencies before pushing something out for testing. |
It would've been nice if an example was included in the documentation on how to revert to the original behaviour. |
Using SqlClient V4 I am expecting the connection string to require |
TrustServerCertificate is not required if the server's certificate is implicitly trusted by the client, e.g. it is issued by a certificate authority that has a root certificate already installed in the trusted root store of the client. |
true
.