Totten v. United States
In Totten v. United States, 92 U.S. 105 (1876), the U.S. Supreme Court held that public policy forbids enforcing a secret espionage agreement between a Civil War spy and the United States, despite President Lincoln himself allegedly forming the agreement. Courts lack jurisdiction to hear such claims because the litigation process would require disclosing too much sensitive information to the public.
This is known as "state secrets privilege," because it allows government to deny claims and void agreements for spying. This privilege has been upheld in denying a claim for benefits against the CIA by alleged former agents. See Tenet v. Doe, 544 U.S. 1 (2005) (one of Chief Justice Rehnquist's last opinions).