“Just following orders” is not necessarily a legitimate defence if the government was doing something illegal in the first place.
The app... I don't at all understand what the role of the app is, so I really can't comment on that aspect of the situation.