I'm mad at my girlfriend for telling her friend something I said about her
Why did you get mad at her for that?
She shouldn't repeat anything I said about her to another person.
I would be angry at her too if she told someone else a secret that I have told her in private. But moving forward, I recommend that you explicitly tell her what are the things that she can safely say to other people and what are the things that are private between you two. It is better to be clear than be angry at her again in the future about it.
How can I be sure she will keep anything private now?
You can't be sure right now if this just happened. You have to slowly start to trust her.