It’s not always safe for people to be out. How out to be is a personal decision.
Don’t assume that someone being out in one context means they’re out in call contexts.
Do not ask if someone is gay within earshot of their boss or parents or anyone else who has power over them. No matter how cool you think those people are.
Recognize that your personal attitude about gay/queer/trans/other dangerous secret, does not protect people from the consequences of being out.
The larger context in which being out is dangerous exists no matter what you do - you can only make the world a bit safer by being trustworthy, and part of that is respecting and keeping confidences.
(And this applies generally to stigmatized categories, not just sexual orientation stuff).