كتاب المقدمات
1
The Book of Miscellany
Abu Hurairah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "Every one of my followers will be forgiven except those who expose (openly) their wrongdoings. An example of this is that of a man who commits a sin at night which Allah has covered for him, and in the morning, he would say (to people): "I committed such and such sin last night,' while Allah had kept it a secret. During the night Allah has covered it up but in the morning he tears up the cover provided by Allah Himself."

[Al-Bukhari and Muslim].

وعنه قال‏:‏ سمعت رسول الله صلى الله عليه وسلم يقول‏:‏ ‏ "‏كل أمتي معافًى إلا المجاهرين، وإن من المجاهرة أن يعمل الرجل بالليل عملاً، ثم يصبح وقد ستره الله عليه فيقول‏:‏ يا فلان عملت البارحة كذا وكذا، وقد بات يستره ربه، ويصبح يكشف ستر الله عنه‏"‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏ ‏.‏
Arabic/English book reference : Book 1, Hadith 241