I don't like this argument, I get the 1st amendment/protect sources thing but if TMZ has been sloppy with protecting their sources then that's on them surely not a court to mop up after them. Like if he wasn't the journalist directly involved but TMZ is so sloppy that many employees know about the source then that's their fault no, arguments about courts having to uphold confidential sources broadly seem a bit sus as surely TMZ has a responsibility to keep sources safe.
He's voluntarily prepared to testify that should be his right to do so, it's up to the media companies themselves to implement NDAs restrict access to details of sources surely.