The Obama administration badly broke the public's trust when it secretly collected the phone records of Associated Press reporters and examined emails of Fox News reporter James Rosen in a search for the source of government leaks.
Those actions were wrong, and in response to public and media protests, Attorney General Eric Holder has established new guidelines that he says will both better protect the privacy of media organizations' emails and other communications and will shield reporters from being prosecuted simply for doing their jobs.
The changes include a higher-level review, in some cases up to the attorney general's desk, before the Justice Department would be allowed to prosecute reporters or secretly pursue their communications.
These are good first steps, but our praise comes with a caveat.
Like any policy, this one is only as good as the people who follow it. That means it could change from administration to administration - or even tomorrow.
To prevent such arbitrary changes, Congress should pass a media shield law to protect the news-gathering rights of journalists. Texas and most other states have checks and balances between journalists and the government. Likewise, Congress needs to enact journalist protections at the federal level.
The controversy that sparked these changes emerged in May when the Justice Department told AP that federal investigators had secretly collected phone records. Federal investigators also admitted to scouring Rosen's emails. In both instances, the federal government maintained that the sensitive nature of the leaked national security information justified its actions.
In both instances, the Justice Department failed to follow its normal procedures - request reporters' notes or conversations from news organizations. News organizations often oppose such requests, at which point the government decides whether to wage a court battle.
This process, although imperfect, rightly respects the constitutional protection accorded the press and protects the rights to privacy of individuals who might otherwise end up in a Justice Department file only because they had an email chat with a reporter on an unrelated subject.
The Obama administration departed from those safeguards, then insisted that there was no plan to charge Rosen.
Instead, officials said they portrayed Rosen as a potential suspect only to get a judge to approve access to his emails in the hope that would lead them to the leaker.
This was a clear abuse and such an excessive expansion of existing policy that it could intimidate reporters from doing their jobs and sources from sharing information with the press.
The ultimate test of Holder's latest guidelines will come the next time the Justice Department faces a difficult investigation.
Will it stick to the new policy or overreach once again?