When you say "you thought" do you mean you were somehow tricked by higher ups?
I've been there. I often wonder how many others in the industry have.
Ethics not being a desirable quality to some (many? That seems too bold to assert) businesses is ironically part of the reason why ethics is so important to hold onto as an engineer. Some businesses would be elated to find software engineers that have discarded their sense of ethics entirely, to the profit of themselves and the harm of our society.