There's the kicker, no? A lot of human technological progress was made under unfortunate (to put it mildly) harm-filled circumstances, and a lot of that wouldn't have been made at all otherwise because the option to make it with a cleaner conscience simply wasn't there. However if you do ever take such a role, despite its context, even if you have a clear conscience, I'd ask to try to have your work expand and live beyond the patron so that it can one day benefit all humanity. There is so much still buried behind the walls of corporate research that's worthwhile to a much broader group, but efforts need to be made to bring it out. Even more so if there aren't many other vertices of the company trying to pull in a better direction. (Ed: And I'd like to add that despite everything, Facebook engineers seem to be doing remarkably well at this. I won't ever join them but I'm not going to blacklist any interactions with them or worse aggressively target them.)