Purportedly, the Hatch Act.
And nowhere in the Hatch Act does it outlaw criticizing political opponents.
Such activity is considered political activity and cannot be engaged by certain members of the Executive branch under certain circumstances.
Here's just one example the OSC cited:
On December 6, 2017, Ms. Conway appeared in her official capacity on CNN’s New Day and discussed why voters should support Republican Roy Moore, and not support Democrat Doug Jones, in the Alabama special election for U.S. Senate.
5 U.S. Code § 7324. Political activities on duty; prohibition
(a) An employee may not engage in political activity—
(1) while the employee is on duty;
(2) in any room or building occupied in the discharge of official duties by an individual employed or holding office in the Government of the United States or any agency or instrumentality thereof;
(3) while wearing a uniform or official insignia identifying the office or position of the employee; or
(4) using any vehicle owned or leased by the Government of the United States or any agency or instrumentality thereof.