SANTIAGO, Chile — Prosecutors and investigative reporters in Chile have for more than a year been exposing an intricate web of illegal campaign contributions, bribery and corruption, embarrassing top business executives and politicians, including members of Congress and the president’s family.

The revelations, reported by an emboldened news media and fueled by the leaking of names and documents, prompted the Senate this week to approve a bill that would, among other things, punish anyone who makes public information about current judicial investigations, with up to 541 days in prison.

Journalists are calling it a “gag law” that would restrict the public’s freedom of information at a time when the country’s ruling elite are being shamed.

“Why was this never discussed before, when reporters got hold of legal files related to other types of criminals?” said Javiera Olivares, the president of the Journalists Association in Chile. “These people’s rights are also affected, but this law is approved when it is the powerful who are under scrutiny.”