2

In this question, the OP realises he has a problem with trying to store user-supplied HTML in a database and is looking for a way to sanitise it.

Although the accepted answer looks valid on the surface, it's wholly inappropriate to use with unsanitised data, and leads to exactly the same problems the OP was worried about.

Is a down vote and large, bold warning enough in this case? The answer is quite long and my comment will almost certainly be below the fold, so it will not necessarily be completely visible to anyone looking in the future.

6
  • 1
    Related: How to Warn of Serious Issues in Code Unrelated to Question?.
    – user456814
    Commented Oct 23, 2015 at 9:46
  • Related: Can I edit an answer to add a prevention message to a security vulnerability?.
    – user456814
    Commented Oct 23, 2015 at 9:50
  • @Cupcake Thanks. I did some searching but couldn't find obvious related questions (an artifact of me using different key words I guess). Commented Oct 23, 2015 at 9:56
  • IMO its not stackoverflow's job to protect people from their own lack of judgement, so I don't see any problem with that answer. Its researched, its complete, it fits the question, its informative. To me this fits in the same way of thinking as dealing with questions that have potential malicious intent, like "how to create a virus". It sets off all kinds of alarm bells but if the question is valid, it is not SO's job to protect the world from yet another potential wannabe virus creator. Its still valid knowledge that can also be used for good.
    – Gimby
    Commented Oct 23, 2015 at 11:28
  • @Gimby To be fair, it's more correct now that the answer has been updated by the author. On the other hand, however, it's SO's raison d'être to be informative. In my opinion, I feel pointing present/future readers towards a solution wholly inappropriate to the problem at hand should be discouraged. Commented Oct 23, 2015 at 12:05
  • @Phylogenesis indeed, if the solution is inappropriate. In this case, I don't see that myself. But only given the odd restriction of "no libraries" that the question itself imposes, you can't have a professional reliable answer to a question which basically dooms itself to mediocrity right from the get-go. Imagine dramatic arm waving to go along with that.
    – Gimby
    Commented Oct 23, 2015 at 13:52

0

You must log in to answer this question.