When it comes to naming an anonymous source, the AP Stylebook’s rule is to be as descriptive as possible, without being specific.
The reporter must be as descriptive as possible when providing
attribution to establish the credibility of the source, yet mindful of
the source’s safety or privacy concerns.
• No: According to the
• Yes: According to top U.S. Department of State officials …
It is also important to clarify why the source wanted to remain
anonymous. For example, a journalist could explain that the company
the source works for does not allow officials to speak with reporters,
or that a major announcement is going to be made via press release.
Source: BKA Content
A reporter has to strike a balance between giving the reader enough information that the source is credible, but not so much that the source can be identified - especially by “those in the know” (eg, investigators, their work colleagues, family).
I think it’s good practice to negotiate with the source about how they want to be referred to in a story and stick to that. But also only quote an anonymous source if there is no other option, and their information can be confirmed by another source that can go on the record.
The reporter should also be careful that quotes from the anonymous source or information they supply that is published won’t lead back to them. (Even saying where the reporter met the source could do this.)
This doesn’t apply to sources giving information as “deep background”. In those cases, the source’s information cannot be published, they cannot be quoted - directly or indirectly - nor identified in any way. All their information has to be sourced and confirmed from multiple other on the record sources before being published. The most famous of these was Watergate’s “Deep Throat”.