The Turnbull government will significantly amend its proposed national security laws to better protect journalists, but has rejected a blanket media exemption from beefed-up secrecy rules.

The crackdown on foreign espionage involves an expanded secrecy regime that was to threaten reporters, editors and others with 15 to 20 years in prison for dealing with protected information.

In the face of sustained protest from media companies and lawyers, Attorney-General Christian Porter will revise the law to restrict the secrecy offences for which journalists can be prosecuted.

People not employeed by the Commonwealth - including journalists and lawyers - will only be liable in serious circumstances where they willingly communicate "secret" or "top secret" information that endangers the health and safety of the public, or prejudices national security.

Journalists will also have stronger defences open to them. They will no longer be required to prove their work was "fair and accurate", and they will only have to demonstrate they "reasonably believed" their work was in the public interest.