After several discussions over the last few days from people who say "specifically, what law did the New York Times violate?" Here it is. The legal remedy for what the New York Times has done is the death penalty and confiscation of the newspaper.
U.S. Code Title 18, Part I, Chapter 37, § 794
§ 794. Gathering or delivering defense information to aid foreign government
(a) Whoever, with intent or reason to believe that it is to be used to the injury of the United States or to the advantage of a foreign nation, communicates, delivers, or transmits, or attempts to communicate… to any foreign government, or to any faction or party… whether recognized or unrecognized by the United States… any document, writing… plan… or information relating to the national defense, shall be punished by death or by imprisonment for any term of years or for life, except that the sentence of death shall not be imposed unless the jury or, if there is no jury, the court, further finds that the offense resulted in the identification by a foreign power… directly concerned… early warning systems, or other means of defense or retaliation against large-scale attack; war plans; communications intelligence…. or any other major weapons system or major element of defense strategy.
(b) Whoever, in time of war, with intent that the same shall be communicated to the enemy, collects, records, publishes, or communicates, or attempts to elicit any information with respect to… any other information relating to the public defense, which might be useful to the enemy, shall be punished by death or by imprisonment for any term of years or for life.
(c) If two or more persons conspire to violate this section, and one or more of such persons do any act to effect the object of the conspiracy, each of the parties to such conspiracy shall be subject to the punishment provided for the offense which is the object of such conspiracy.
(1) Any person convicted of a violation of this section shall forfeit to the United States irrespective of any provision of State law—
(A) any property constituting, or derived from, any proceeds the person obtained, directly or indirectly, as the result of such violation, and
(B) any of the person’s property used, or intended to be used, in any manner or part, to commit, or to facilitate the commission of, such violation.