There are many people who forget to mask out sensitive connection credentials when posting code. I know this sounds magical, but can SO do some keyword checking to find sensitive strings (passwords, app secrets, etc.), and mask them with XXX or ***?

  • Yep, that would be pretty magical. How do you tell a password from any other data? Mar 26, 2014 at 6:55
  • some common function names such as mysqli_connect() in PHP specifies which parameter is a password.
    – Raptor
    Mar 26, 2014 at 6:56
  • Not a feature-request, but related: meta.stackexchange.com/questions/132117/… Mar 26, 2014 at 7:14
  • 2
    It would only "protect" people posting bad code. In any properly written application such data is in a separate config file so you wouldn't accidentally paste it. Mar 26, 2014 at 7:19
  • 1
    Obligatory bash.org reference
    – blahdiblah
    Mar 26, 2014 at 20:01
  • always got a lot downvote when being good to suggest something new. Can you guys not be a hater a while?
    – Raptor
    Mar 27, 2014 at 2:12

1 Answer 1


I commented above, but I feel like expanding that into an answer: No, this isn't a good idea.

Firstly, in the general case it's basically impossible to tell sensitive data apart from other data. If the software masks non-confidential but vital data, fun things happen. The only reliable way to tell sensitive data from other data is a human - or one ridiculous supercomputer with ridiculous software.

Secondly, even if it is possible to sniff out specific instances of confidential data, that would lull some users who had their bacon saved by it the first time into a false sense of security ("oh, it'll strip out the sensitive stuff for me"). For why this is bad, see above paragraph - there will always be something the software isn't trained to catch. (I am assuming that some posters to SO don't think quite as hard as they should, making them susceptible to being lulled as above; based on the sheer amount of stuff on Meta about interesting behaviour by some users, this seems a valid assumption. (If you're reading this, you're probably not one of those.))

To return to my first point, the best way to find data that needs masking (and mask it) is probably a human. We have no shortage of humans here. Someone is bound to find your post, edit out the sensitive stuff, and flag the revision for deletion so the mishap disappears ASAP. (But do change/invalidate that credential anyway; people know it now.) So why use dev time on a "feature" that will generate many more false positives and false negatives, increases load on the servers, takes dev resources away from things we need more, and is already adequately handled by real editors?

  • Agree your points, but the password stays forever in the revision history of the question. That's the issue.
    – Raptor
    Mar 26, 2014 at 7:11
  • 1
    @Raptor Did you miss "and flag the revision for deletion"? (This is a custom flag on the post, as revisions themselves can't be flagged.) Mar 26, 2014 at 7:12
  • 2
    That's not a problem. You need to change that password anyway once you posted it. Besides that, we delete such revisions if we are notified of them (e.g. through a flag). But still, you must change that password. Mar 26, 2014 at 7:17
  • @Raptor Also, what ThiefMaster said (which should be common sense, as people probably know your credential now). Mar 26, 2014 at 7:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .