I know this is a different question but I hope someone has an answer for it. In Islam, it’s a sin to lie. At the same time, it’s a sin to expose your sins. If a person asks another person to tell them if they have done a certain sin or not, and in reality they have done it, then what should they do? They can either say the truth which would mean exposing their sins. Or they can say that they haven’t done the sin which would mean that they are lying.
assuming that we have understood the gravity of exposing sins and lying (except in 3 cases), the best way to reconcile with the situation you have mentioned would be to avoid the person who is asking.
no good muslim would ask another muslim about their sins let alone try to expose them. when someone asks you such question, remind them that it is not permissible in islam and we should not entertain such people.
when faced with such situation, follow the example of Abu Bakr (R.A), the most trustful of this ummah. i will quote the incident below.
Abu Bakr al-Siddeeq the most truthful man of the ‘Ummah who accompanied the prophet ( may Allah exalt his mention ) on his flight to Madeenah, was accosted by an acquaintance of his who did not know the Prophet ( may Allah exalt his mention ) by face but had probably heard of the Makkan search for him. He asked Abu Bakr (may Allah be pleased with) him about his companion, to which Abu Bakr (may Allah be pleased with) him said: "He is my guide. He shows me the way." Abu Bakr did not lie even in such dire circumstances, but simply equivocated.
[refference : al-sira al nabawiyya by ibn kathir]
we must refrain from telling a lie as much as we can and avoid such scenarios that could lead us to it. next time when you are faced with a situtation like that, remind them of the hadith.
It was narrated from Abu Hurairah that the Messenger of Allah (ﷺ) said: “Whoever covers (the sin of) a Muslim, Allah will cover him (his sin) in this world and in the Hereafter.” [Sunan Ibn Majah 2544]
may Allah the mighty and sublime grant you mercy and guide you to the straight path.
Allah knows best.