Most criminals who engage in any kind of criminal activity are usually living dangerous lives as it is. Working with the mob? Drug dealing with Mexican cartels? Finance crimes with sketchy people like Jeffrey Epstein? Engaging in credit card fraud with Russian mobsters?
I would say a majority of profitable criminal activity involves dealing with some form of violence or violent people to begin with. Criminals know the inherit risk with what they do or who they're involved with.
Why is it ok that law enforcement get to decide what punishment a criminal should receive? You don't think that has a risk of trending society towards a police state where law enforcement power is not checked at all?
Innocent people getting thrown in jail happens. Say the police give this type of public exposure to an actually innocent person and that innocent person gets convicted. Say a newspaper article reports on the lie that the given innocent person was cooperating with police and that article is read by a big audience. That innocent person runs the risk of being murdered in jail because they have been marked as a snitch by law enforcement.