views:

330

answers:

5

We're migrating one of our sites to ASP.Net. We do not want to use integrated security, which uses the windows account to connect to sql server (not going to get into why, its just out of the question). We created a username and password to connect to SQL Server, and would like to use that username and password, however, we also do not want other developers to see this information (easily read from the web.config).... I know it can be encrypted, but it can just as easily be decrypted by the developers - plus encryption has a performance hit.

Is there any solution to this problem?

+2  A: 

here's a good tutorial on Encrypting Configuration Information in ASP.NET 2.0 Applications

Just don't give the other developers the key

Alternatively, you can lock down the authentication for SQL via installed certificates. This way you are setting security based on the client not the user. http://msdn.microsoft.com/en-us/library/ff649255.aspx

Our standard practice is to have one "Developer Login" used in the development database that has limited access and have a different username/password for the production box. Developers do not have access to the production box, only the lead developers, and then the production web.config is copied over via the deployment script.

Glennular
This applies to mine and your comments as I have never encrypted a web.config file. But after reading your link, what prevents a dev from setting an object up (dim sqlConn as new sqlconnection(getConfigSection), IIS auto decrypts) and then setting a string variable = object.connectionString? Or using the debugger to get that info doing a step-by-step debugging?
Tommy
you are going to have to either authenticate off of the workstation or a certificate, because all developers will have access to the debugger
Glennular
A: 

Do the developers need access to the web.config file? If so, I think you may be out of luck. If not, meaning that they do not ever need to change the web.config file, change the permissions on it so that only admins and the asp.net process can read the file.

Tommy
A: 

In my experience, it tends to be difficult to hide that kind of thing from your internal devs. Even encrypting the config infroamtion in the webconfig would still show if your developers just stepped through the code...

I would guess that, if you HAD to do this, you could create a private constant string in the code for your DB string and then use Dotfuscator or similar on the compiled application. Obviously, the source code itself would also have to be encrypted or your developers otherwise prevented from accessing it.

AllenG
A: 

You can't really protect the password from developers - besides, what sense does it make? What you can do is to have separate development server to which developers have access and production environment, to which they don't.

Don't developers ever need to log on directly to database to run some tests or something? if they do, it would make sense to do the test using the same account that is used by the application, otherwise the test results may not reflect reality.

Piotr Rodak
A: 

prompt for the password, when you connect for the first time and track the passowrd in session. Now only you'll be able to connect the database from anywhere. Redirect all those to application-unavailable page to rest of the users that they don't have the password.

this. __curious_geek