A secret court overseeing government surveillance programs has sided with Yahoo and ordered the Obama administration to declassify and publish a 2008 court decision justifying Prism, the data collection program revealed last month by the former security contractor Edward J. Snowden. Judge Reggie Walton issued the ruling on Monday, and the government is expected to decide by Aug. 26 which parts of the decision may be published, according to a separate court filing by the Justice Department. Publication could give a rare glimpse of how the government has legally justified data collection under the Foreign Intelligence Surveillance Act.