There are some situations in which withholding information is clearly unjustifiable and others in which it is necessary. For example, in the Flint water crisis of 2016, there were official concerns about water contamination that were not revealed to the public in a timely fashion. This meant that Flint residents, including young children and the frail elderly, who are particularly vulnerable, were drinking contaminated water. In this case, lack of full disclosure is not only unjustifiable but morally wrong, as it endangered the health of citizens.
A case where a government may be justified in withholding information is in the case of war. Making public information about troop deployment or military technology may endanger the lives of soldiers. Similarly, although there were certain benefits to Snowden's release of classified NSA documents in 2013-2014, including revelation of the extent to which the US was spying on its own and foreign citizens, the case brought to the public eye the question of how much information the government was justified in withholding. For example, much of the intelligence work on global terrorism requires the use of intelligence agents or spies. Keeping the identities of such agents secret is essential for their safety and revealing this information, as Snowden did, can endanger the lives of many people.
In general, a government is justified in keeping information secret when revealing that information might endanger the lives of military or intelligence personnel or the ability of the government to safely and successfully carry out military or security operations.