It is a defense to a prosecution under section 3121 of this title that before the commission of the offense with which the defendant is charged, the United States had publicly acknowledged or revealed the intelligence relationship to the United States of the individual the disclosure of whose intelligence relationship to the United States is the basis for the prosecution.
Quick search by citation:
50 U.S. Code § 3122 - Defenses and exceptions
(a) Disclosure by United States of identity of covert agent
(b) Conspiracy, misprision of felony, aiding and abetting, etc.
Subject to paragraph (2), no person other than a person committing an offense under section 3121 of this title shall be subject to prosecution under such section by virtue of section 2 or 4 of title 18 or shall be subject to prosecution for conspiracy to commit an offense under such section.
Paragraph (1) shall not apply (A) in the case of a person who acted in the course of a pattern of activities intended to identify and expose covert agents and with reason to believe that such activities would impair or impede the foreign intelligence activities of the United States, or (B) in the case of a person who has authorized access to classified information.
(c) Disclosure to select congressional committees on intelligence
(d) Disclosure by agent of own identity
Section was formerly classified to section 422 of this title prior to editorial reclassification and renumbering as this section.