white hat
noun
• a good or moral person, especially the hero in a film, novel, or play.
• "that account, dominated as it is by conflict between black hats and white hats, is hardly the whole truth"
Origin:
1950s: from the colour of the hat traditionally worn by the good characters in westerns. Compare with black hat.