Reputation after leaving a not so good company

Very true. Have you already mislead them? If so I don’t know how to handle that.

If you haven’t already mislead them, and if it were me I would object to the direction immediately. Sure, you might get fired, but if that’s their response to refusing to carry out unethical direction then is that somewhere you want to be working?

Besides, it’s much easier to explain your termination because you were trying to do the right thing rather than go along with it and risk your reputation, or worse end up in a lawsuit.

Ideally you can resist the direction, but work with them on an ethical solution to the problem that benefits all parties. If you can’t, leave.

Depending on which country or state you live in you might have corporate whistle blower protection, that’s something to consider, maybe ask a lawyer.