I was an enlisted Marine and an AF officer. The enlisted oath does not require the following of a clearly unlawful order from senior officers or from the president.
I was taught that as a part of the law of armed combat back in the early 70s.
By the way, the officer’s duties of the office also include that they will follow LAWFUL orders from more senior officers including the president. They are not out there on their own without the same restrictions.
Understood...that is a part of the UMCJ and the honorable discharge and fulfilling of their duty according to the oath taken.