This question was originally posted with a similar title to this but was changed as the subject was not a moral issue.
However it was a good topic for a wiki question.
There are times when you are asked to implement features which you are not comfortable with, perhaps some mass emailing program, or something which access data on a PC which is not really its to access. I would put these as morally objectionable. However there is a line when this becomes also illegal, INAL so I won't give examples.
Is it a developers’ job to know the law enough to call on these? Is it right to say no to a request on the basis of it being illegal? Can you and should you get legal advice if you are not sure? Who is liable for the effects of code you right?
Their are a lot of questions there, but in short how do you handle situations where you think that code you are asked to write may be on the wrong side of the law?
edit:
Are developers really responsable for what their code does? This seems like making a machine operator at smith and western responsible for what any guns he produces do.