If you are angry, it is difficult to discern what are the truths. So it is useful to approach criticism both from good and bad intentions both in the same way. In other words, by default, if you get angry, try to figure out what in the criticism makes you angry.
In the professional world, giving feedback with tact and respect for the contributor is what we get paid for and enables a team to contribute to the company’s success.
If someone on the team doesn’t feel like they’re treated with respect, even when their work needs improvement, it doesn’t matter whether the feedback was given with good or bad intentions.
If there is a person consistently giving hurtful feedback and I would be in a position to get the person fired, I would do it. (And I have done it.) And I would not work in such a work environment. At least 50% of programming work in typical organizarions is about getting along with people.
But I have found myself in environments where I needed to tolerate this to a degree. And the only thing you can ultimately change is your own attitude. If you can see that hurtful criticism may be even more truthful than other criticism, it helps to develop the right attitude.
Of course, the dangerous part is that you may learn the wrong thing. Extracting constructive feedback from criticism that was not intended to be constructive requires a certain level of self-confidence and psychological safety that's only possible when it's an unusual event rather than a continuous drag on your self-worth.
AIUI, CBT's primary method is to convince you to pause between feeling and acting, so that you can ask yourself if you have made an accurate assessment of reality and can plan an appropriate response.
(Easier to say than to embrace, of course.)