Not intending to inflict Godwin's law, but the "Nazi soldier defense" is unacceptable. There is no just following orders, or if I do not do it, they will find somebody else. You simply do not do things which you think are wrong. Yes, that could mean that you might have to find a different job. As a software developer you are responsible for everything you create. You are also responsible for challenging designs/solutions handed to you.

There is a reason why the "true" engineering disciplines object to the term software engineer. It is because in general software developers do not respect the engineering ethics.