Warning to Those Who Boast about Their Sins
Question

I boasted about my sins that I committed that Allah had hidden from people. I read that such a person cannot be forgiven? Is this true? Is there any way out?
Praise be to Allah.The Importance of Concealing One’s Sins in Islam
The Muslim should be far removed from obscenity and obscene actions. One of the most evil of things is that Muslims should openly manifest their immoral actions and their being far from Allah.
An example of this is when a Muslim commits a sin which angers Allah, His Creator, Master and Lord, and Allah, the Concealer, the Most Generous, the Forgiver, who could, if He willed, cause the earth to swallow him when he is committing that promiscuous act and neglecting the sacred limits set by Allah, conceals his action. Even worse than that, he becomes proud of angering Allah and spreads news of that among people, uncovering that which Allah has concealed from the people. How could Allah forgive something like this?
Hence Allah may deprive a person like this of repentance.
Prophetic Warnings Against Boasting About Sins
It was narrated that Salim ibn `Abdullah said: I heard Abu Hurayrah say: I heard the Messenger of Allah (peace and blessings of Allah be upon him) said:
“All of my Ummah will be fine except for those who commit sin openly. Part of committing sin openly is when a man does something at night and Allah conceals it, but in the morning he says, O So-and-so, last night I did such and such. His Lord had covered his sin all night, but in the morning he removed the cover of Allah.” (Narrated by Al-Bukhari, 5721; Muslim, 2990)
Al-Hafidh Ibn Hajar (may Allah have mercy on him) said:
Concerning the command to cover or conceal , a Hadith was narrated which does not meet the conditions of Al-Bukhari. This is the Hadith of Ibn `Umar which is attributed to the Prophet (peace and blessings of Allah be upon him): “Avoid these obscenities which Allah has forbidden. Whoever commits any of them, let him be concealed with the concealment of Allah.” The Hadith was narrated by Al-Hakim and is also included in Al-Muwatta’ as one of the Mursal reports of Zayd ibn Aslam.
Why Flaunting Sins Is a Disrespectful Act Toward Allah
Ibn Battal (may Allah have mercy on him) said: Openly flaunting one’s sins implies disrespect towards Allah and His Messenger, and the righteous believers, and is a type of stubborn provocation. Concealing sin protects one against being disrespectful in this manner, because sin brings humiliation upon the people who commit it, such as the Hadd punishment if it is a sin that carries such a penalty, or the Ta`zir penalty if no Hadd is enjoined. If it is something which violates the rights of Allah, then He is the Most Generous and His Mercy precedes His Wrath. Hence if He conceals it in this world, He will not expose it in the Hereafter, but the one who flaunts it openly loses all of that.
The Hadith clearly condemns those who openly flaunt their sin, which implies praise of those who conceal their sin. The fact that Allah conceals it implies that the believer must also cover himself. Whoever deliberately flaunts his sin angers his Lord, Who will not then cover him. Whoever deliberately conceals his sin out of shame before his Lord and before people, Allah will bless him by concealing it. (End quote from Fat-h Al-Bari, 10/487-488)
Al-Mannawi (may Allah have mercy on him) said:
What is meant is those who talk openly to one another about their sins. Ibn Jama`ah included in this disclosure of what happens between husband and wife of permissible things. This is supported by the famous report which warns against that: “It is part of flaunting ones sins” – i.e., speaking openly about them and broadcasting them – “that a man should do an evil deed at night, then the following morning, when Allah had covered him, he says, Last night I did such and such` – when all night his Lord had concealed his sin, but in the morning he uncovers what Allah had concealed.” – by telling people about his sin.
This is a betrayal on his part of the covering of Allah which had been lowered upon him, and a provocation of the desire for evil in the people who hear him or see him. So these are two offences which are added to his original offence and make it worse. If in addition to that he encourages others to do likewise, this is a fourth offence that makes the matter even worse…
The implication is that they have no sins unless they flaunt them, then he explained that the one who flaunts his sin is the one who does something at night and his Lord conceals it, then in the morning he says, O So-and-so, last night I did such and such, so he removes the covering of Allah. He is to be condemned in this world by carrying out the Hadd punishment, for it is among the attributes and blessings of Allah that He brings forth what is beautiful and conceals what is ugly.
So openly flaunting sin is a rejection of that blessing and disrespect towards the concealment of Allah.
An-Nawawi (may Allah have mercy on him) said: It is disliked for the person who is tested with sin to tell anyone else about it. Rather he should give it up, regret it and resolve not to do it again. If he tells his Shaykh or a similar person who he hopes can teach him a way out from it or show him how to keep himself from falling into similar sins, or can tell him the reason why he fell into it, or make du`a for him, etc., this is fine.
But is it disliked (to tell someone else) if there is no benefit in doing so? Al-Ghazali (may Allah have mercy on him) said: The kind of disclosure which is blameworthy is when it is done by way of openly flaunting sin and mocking, not when it is done to ask questions and seek fatwas. The evidence for saying this is the report of the man who had intercourse with his wife in Ramadan, and he came and told the Prophet (peace and blessings of Allah be upon him), who did not rebuke him for telling him. (End quote from Fayd Al-Qadir, 5/11-12)
The way out from your situation, is sincere repentance to Allah, and not going to extremes in committing sins. If you do happen to commit a sin, do not tear away the covering with which Allah conceals your sin.
For more details, please see the following answers:
Means of expiating sin
What are the sins committed when one is alone?
Sin and its Effects on the One Who Commits it
And Allah knows best.