German civil servants carry die volle persönliche Verantwortung, the full personal responsibility, for the lawfulness of what they do in office. The law states what follows: Bedenken gegen die Rechtmäßigkeit dienstlicher Anordnungen haben Beamtinnen und Beamte unverzüglich bei der oder dem unmittelbaren Vorgesetzten geltend zu machen. (Civil servants must raise concerns about the lawfulness of official orders without delay with their immediate superior.)
It is a duty, not a right. If the order stands and the doubts remain, the civil servant must go to the next superior above. If that superior confirms the order, the civil servant carries it out and is no longer personally responsible, unless the conduct ordered would violate human dignity, or is a criminal or administrative offense that the civil servant can recognize as such.
This procedure is called Remonstration. The German Wikipedia adds that it is rarely used in everyday practice, because a civil servant who uses it often fears being labeled a Querulant, a troublemaker.