If I tell my boss that doing xyz is illegal and he doesn't dispute it, I'm absolutely certain he would not ask me to implement it.
Certainly there will be shittier bosses that will ask anyway, demand it, and perhaps even go so far as to fire someone for not violating the law, but I should hope those in the last category are few and far between and there would be internal and/or external outcry over it. Even if you have a boss that wants to fire you over it and nobody cares internally or externally (I'd find this situation very unlikely), you'd still get unemployment benefits / severance / whatever is typical in your jurisdiction, since you were fired rather than choosing to leave yourself.
In the US there are very few, if any, laws against dark patterns and data collection. The only real fine seems to be FAANG execs need to spend half a day on Zoom talking to Congress who are seeking soundbites more than change.
We work for very different companies if you expect your boss to lie outright. I'm not disputing this will exist, I'm just not sure this is the common case in skilled IT jobs.
Then we'll have a nice discussion about whether it is or not (or we ask the legal team). If it's legal then it's still up to me whether I find it okay, and then it's really my personal choice if I want to leave the company over this or if I want to try to get someone else to implement it or whatever. However, that wasn't really the point being discussed.
I was specifically talking about the scenario where you're asked to do something illegal and immoral, and its illegality is not disputed by the boss or legal team or something.
If I tell my boss that doing xyz is illegal and he doesn't dispute it, I'm absolutely certain he would not ask me to implement it.
Certainly there will be shittier bosses that will ask anyway, demand it, and perhaps even go so far as to fire someone for not violating the law, but I should hope those in the last category are few and far between and there would be internal and/or external outcry over it. Even if you have a boss that wants to fire you over it and nobody cares internally or externally (I'd find this situation very unlikely), you'd still get unemployment benefits / severance / whatever is typical in your jurisdiction, since you were fired rather than choosing to leave yourself.