What makes a programmer different than any other person who needs to ask the same question to himself/herself? What about unethical weapons, medicine, sales practices?
It's not a sure way to ensure you never encounter these problems, but it will reduce the likelihood.