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

Persist Security Info=false isn't respected #448

Closed
roji opened this issue Feb 26, 2020 · 1 comment · Fixed by #453
Closed

Persist Security Info=false isn't respected #448

roji opened this issue Feb 26, 2020 · 1 comment · Fixed by #453
Assignees
Labels
🐛 Bug! Issues that are bugs in the drivers we maintain.
Milestone

Comments

@roji
Copy link
Member

roji commented Feb 26, 2020

With Microsoft.Data.SqlClient on netcoreapp3.1, the password is present in SqlConnection.ConnectionString after Open has been called. As per the docs, once Open is called, all security info is supposed to be stripped from the user-exposed connection string. System.Data.SqlClient behaves correctly. This can be seen with MS.Data.SqlClient versions 1.1.1 and 2.0.0-preview1.20021.1.

using System;
//using System.Data.SqlClient;
using Microsoft.Data.SqlClient;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            var conn = new SqlConnection(@"Server=localhost;Database=test;User=SA;Password=Abcd5678;Persist Security Info=false");
            conn.Open();
            Console.WriteLine("Connection string: " + conn.ConnectionString);
            // With Microsoft.Data.SqlClient, outputs Server=localhost;Database=test;User=SA;Password=Abcd5678;Persist Security Info=false
            // With System.Data.SqlClient, outputs Server=localhost;Database=test;User=SA;Persist Security Info=false
        }
    }
}
@cheenamalhotra
Copy link
Member

I confirm issue is reproducible in .NET Core with Microsoft.Data.SqlClient, while .NET Framework seems to be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug! Issues that are bugs in the drivers we maintain.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants