So, if I understand this properly, you're saying that the government can't make you sign away your first amendment rights, but they can order you not to speak ('disclose information') and then jail you?
Also, it's not really a counterexample, because you do not sign away your rights when you sign the enlistment papers, you loose some of your rights by simply being part of the military. People who where drafted back in the 60s also lost had their rights limited, even though they did not voluntarily sign any papers or agreed to anything.
Further, this is an act of the government, and not a civil contract. No CIVIL CONTRACT can take away ANY of your constitutional rights.
http://www.firstamendmentcenter.org/judge-nursing-student-wa...
Civilian law generally applies to active duty military personnel the same as to anyone else (though some laws have express exceptions or alternate provisions for military personnel), and the UCMJ even provides for the delivery of military personnel accused of violations of law by the civil authorities to be delivered to those authorities. [UCMJ Art. 14, 10 U.S.C. Sec. 814]
More to the point upthread, members of the military retain First Amendment rights, and military regulations have been struck down for violating the First Amendment.
Its not unheard of for senior officers' careers to be ended after a negative OIG report.