Rasul Allah (sal Allahu alaihi wa sallam) said: “When a man says something, then glances left or right, his words are a confidence to be kept.” [Hasan hadith. Tirmidhi]
Imam Nahlawi says: “Telling a secret means to inform others of a remark, action, or state which one learns of from someone who wants it to remain hidden, whether it be good or bad. This is hurting him, and hurting others is unlawful.”
“Whenever people meet, it is obligatory to keep secret any act that occurs, any word spoken, or any state attributable to someone, when these concern something one would normally wish to remain confidential.” [al-Durar al-Mubaha fi al-Hazr al-Ibaha, quoted in “Reliance of the Traveller” by Ahmad ibn Naqib al-Misri]
In Islam, there is no need to tell a Muslim 'Promise you won't tell'. It becomes a duty in front of Allah (SWT) to maintain the secret once it is evident that the speaker does not want it to be shared with anyone else. You should only share the secret if concealing it hurts the rights of someone that Allah (SWT) gave them.
The Messenger of Allah (peace be upon him) said: “My entire nation is safe, except al-Mujahirin (those who boast of their sins). Among the Mujaharah is that a man commits an (evil) act, and wakes up in the morning while Allah has kept his (sin) a secret, he says: “O so- and-so! Last night I did this and that.” He goes to sleep while Allah has kept his (sin) a secret but he wakes up in the morning and uncovers what Allah has kept a secret!” [Saheeh al-Bukhari]
If you become aware of another's flaws, keep it a secret. Allah’s Messenger (peace be upon him) said: “He, who relieves a hardship of this Dunya (world) for a believer, Allah will relieve (from him) a hardship of the Day of Resurrection; he who makes easy an indebted person, Allah will make it easy for him in the Dunya and the Hereafter; he who covers a Muslim (meaning his mistakes and shortcomings), Allah will cover him in the Dunya and the Hereafter …” [Sahih Muslim]