Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Today I found what looked to be my supervisor's password in some code in version control. The password is to a database. He is very experienced and has explained before how to avoid having passwords in the source code.

How should I handle this situation? Is there a best practice about preserving evidence of a security flaw, or should I remove such data as soon as I see it?

Even if I remove the data in the current revision, there's still the revision history. Should I just alert my supervisor instead?

share|improve this question
This is not programming specific. –  Oded Feb 8 '12 at 14:40
I thought version control, was kinda programming specific. Like version control adds an extra leval of complication -it can't simply be deleted. Is there a "Dealingwithsensitive data.Profesionals SE"? –  Oxinabox Feb 8 '12 at 14:48
Oxinabox "dealing with sensitive data" is possibly on topic, but your question is focused on how (and if) to approach your boss, which has nothing to do with software development. –  Yannis Rizos Feb 8 '12 at 14:54
Since this is closed I can't post this as an answer, but just ask him what the password is for. Don't point out that the password was entered by him since that will put him on the defensive. Let him realize that it was something he shouldn't have done on his own. If he doesn't suggest removing it himself after realizing it's the database password, ask him if he thinks you should remove it. I'm not that familiar with version control, but you can also ask if it can be permanently deleted from all revisions, and if not you can also suggest changing the password. –  Rachel Feb 8 '12 at 15:34
Perhaps you can rephrase the question so it is asking what you should do when you find sensitive data in your version control, rather than being a question on how to confront your boss about something he/she did wrong. If you do, flag it for moderator attention and they'll reopen it if it meets the guidelines in our FAQ. See this chat log for some examples –  Rachel Feb 8 '12 at 19:38
show 7 more comments

2 Answers

up vote 3 down vote accepted

All version control systems I am aware of have some form of "obliterate" capability that allows you to remove data permanently. This is normally not something you want to do lightly as it inevitably involves rewriting history. Most version control systems in fact restrict this ability to administrators or at least to users with direct access to the central repository. In a distributed version control system like git, this is complicated by the fact that many people may have clones of the repository and therefore copies of the sensitive data. If you cannot guarantee that all copies are destroyed, you have a problem.

Some general advice from an SCM pro: As a matter of policy I won't use any "obliterate" equivalent unless requested to do so by the company's legal department. This is because, as I said, you are rewriting history, and the history of the code in your repository can be considered legal evidence in some cases. I probably would recommend not removing a password as a password can be changed.

In your particular instance, I would strongly recommend that you not do anything without talking to your supervisor, even if you do have the access or the knowledge to remove the password. Messing around with the history in your repository is not something you should be doing on your own authority.

share|improve this answer
add comment

Remove the reference from the code, as it's not safe.

Communicate to him that his current password has become compromised listing the reason.

Have him change it and tell everyone coding this should never happen again.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.