Hilchos Lashon Hara chapter 4, section 1
It is forbidden to say anything about another person that would shame them, even when they are not there.
Even if a person saw them behave wrongly in something between them and Hashem, it is still forbidden to put them down for it – even though that person really did not act properly toward Heaven.