Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to secure password from developers

How to secure password from developers

Scheduled Pinned Locked Moved C#
8 Posts 5 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    srikrishnathanthri
    wrote on last edited by
    #1

    Hello, I am looking for a password protection method in .net for connecting SQL server. I have a requirement is to secure passwords from developers. I know most of people will suggest me to use config file store password and some people say use windows authentication. But my requirement is quite different, I don’t want to reveal password to developers. If I use it in config file the password will be known to developers. How to deny access to config file for developers and give to access to visual studio to that config file? If I use Windows authentication there is risk of connecting directly to the database server by installing management studio or some other third party tools. Is there any way that will make windows authentication will work only if access from code?

    OriginalGriffO L N D 4 Replies Last reply
    0
    • S srikrishnathanthri

      Hello, I am looking for a password protection method in .net for connecting SQL server. I have a requirement is to secure passwords from developers. I know most of people will suggest me to use config file store password and some people say use windows authentication. But my requirement is quite different, I don’t want to reveal password to developers. If I use it in config file the password will be known to developers. How to deny access to config file for developers and give to access to visual studio to that config file? If I use Windows authentication there is risk of connecting directly to the database server by installing management studio or some other third party tools. Is there any way that will make windows authentication will work only if access from code?

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      You can't. Because the connection string is just that - a string - the code that developers write needs to be able to access the "raw string" that is sent to SQL as part of the Connection event. Because their code can access it, so can the developers. All you can do is give them username / password combinations which are just sufficient to do their job (i.e. can insert, select, maybe update - but not add, edit, or create tables) and if you are still feeling paranoid log everything that user account does. But even trying to prevent them having access when they clearly are going to need it says "I don't trust them" and that's not good for morale or the culture within the company. You may find it counterproductive in terms of retaining good staff - the ones you can trust...

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • S srikrishnathanthri

        Hello, I am looking for a password protection method in .net for connecting SQL server. I have a requirement is to secure passwords from developers. I know most of people will suggest me to use config file store password and some people say use windows authentication. But my requirement is quite different, I don’t want to reveal password to developers. If I use it in config file the password will be known to developers. How to deny access to config file for developers and give to access to visual studio to that config file? If I use Windows authentication there is risk of connecting directly to the database server by installing management studio or some other third party tools. Is there any way that will make windows authentication will work only if access from code?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        See sql password C# - Google Search[^].

        1 Reply Last reply
        0
        • S srikrishnathanthri

          Hello, I am looking for a password protection method in .net for connecting SQL server. I have a requirement is to secure passwords from developers. I know most of people will suggest me to use config file store password and some people say use windows authentication. But my requirement is quite different, I don’t want to reveal password to developers. If I use it in config file the password will be known to developers. How to deny access to config file for developers and give to access to visual studio to that config file? If I use Windows authentication there is risk of connecting directly to the database server by installing management studio or some other third party tools. Is there any way that will make windows authentication will work only if access from code?

          N Offline
          N Offline
          Nathan Minier
          wrote on last edited by
          #4

          There's a very easy method. 1. Use windows domain authentication 2. Run your application (or application pool, if IIS) under a service account. Give that service account the appropriate permissions on the database (which would have to be on a domain machine in this scenario). Don't give the password to your devs, set this up yourself (or whatever Security person you have assigned to account actions). 3. Make sure that dev accounts don't have access to the SQL server if you're worried about them using SSMS.

          "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

          L 1 Reply Last reply
          0
          • N Nathan Minier

            There's a very easy method. 1. Use windows domain authentication 2. Run your application (or application pool, if IIS) under a service account. Give that service account the appropriate permissions on the database (which would have to be on a domain machine in this scenario). Don't give the password to your devs, set this up yourself (or whatever Security person you have assigned to account actions). 3. Make sure that dev accounts don't have access to the SQL server if you're worried about them using SSMS.

            "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Nathan Minier wrote:

            There's a very easy method.

            ..still would rather see a DB created by a developer :)

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            N 1 Reply Last reply
            0
            • L Lost User

              Nathan Minier wrote:

              There's a very easy method.

              ..still would rather see a DB created by a developer :)

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

              N Offline
              N Offline
              Nathan Minier
              wrote on last edited by
              #6

              Not going to completely disagree, but this is one of those places where my dev self and my security self get into fistfights.

              "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

              L 1 Reply Last reply
              0
              • S srikrishnathanthri

                Hello, I am looking for a password protection method in .net for connecting SQL server. I have a requirement is to secure passwords from developers. I know most of people will suggest me to use config file store password and some people say use windows authentication. But my requirement is quite different, I don’t want to reveal password to developers. If I use it in config file the password will be known to developers. How to deny access to config file for developers and give to access to visual studio to that config file? If I use Windows authentication there is risk of connecting directly to the database server by installing management studio or some other third party tools. Is there any way that will make windows authentication will work only if access from code?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                All code that is running is running AS THE USER THAT LAUNCHED IT. If the developers cannot access the content of the config file, neither can Visual Studio nor the application the developers launch in the debugger. You seem to have only a single environment, production, where you need at least three. You need a developer environment that the developers have enough access to so they can develop the application and the database. You need a test environment that mirrors production so you can test the application and database changes before you put it in production and also test the deployment of the application and database changes. Finally, and obviously, you need a production environment. In your case, all three of these need to have their own separate database servers with their own connection strings. They don't need to be the same. But, it comes down to the point where you absolutely need to trust at least two people with the passwords to the production database. They don't have to be developers but they do have to know what they're doing with connection strings. You cannot avoid this. But, on top of all of this, you and your SQL DBAs, system admins and networking people need to understand security, in SQL, in Windows Server, NTFS, ... to correctly setup every environment and all of the servers and shares to make sure nobody has more permissions than they need to do their jobs.

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                1 Reply Last reply
                0
                • N Nathan Minier

                  Not going to completely disagree, but this is one of those places where my dev self and my security self get into fistfights.

                  "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  ..lock them both up together until they agree? This is only a "problem" if you want to hide your database-structure, either from dev or the user/owner. In that case it becomes a discussion of who owns the data :)

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups