Humans are generally two faced, one face is light and the other is dark. They show the light side in public and the dark side in private. Just let them hide their true identity in public, to do or say whatever they want and they would reveal their dark side. Very few are completely light, meaning they are light both in public and private. Give such anonymity and they would use it for good.
The reason for being good in public by the "two faces" is to be liked, loved, favored, rewarded with goodness, etc, but take away the public and they become something else. However, those filled with light would still be good both in public and private, will have good intentions, will do good for selfless reasons or are doing good to benefit everyone.
Anonymity enables people do or say things they wouldn't want others to know they did or said, whether good or bad. Give them masks and a platform, with unrestrained, zero consequence or reward for their actions, let them do whatever they want, and they will reveal their true colors, but those who are completely light will continue to be good/light whether in the public or private