What is the ruling on one who discloses secrets?
Question

What is mentioned in Quaran and Hadeeth about revealing a secret to someone that was told in confidence?.
Praise be to Allah.Secrets are a kind of trust, and thus they are a kind of contract or covenant which must be kept. It is necessary to be harsh with those who disclose them, because they are betraying a trust and breaking their promise; and those who deserve to have a ta’zeer punishment should be punished.  
Secrets vary. There are those for which the person who discloses them must be dealt with harshly, because disclosing them causes widespread harm, such as disclosing secrets to the kuffaar and enabling them to defeat the Muslims or gain victory over them. This is what is known in modern parlance as high treason. And there are secrets that are less serious, such as those in which disclosure causes harm to individuals. But in all cases disclosure is a betrayal of the trust and breaking of the covenant. 
Allah says (interpretation of the meaning): 
“And fulfil (every) covenant. Verily, the covenant will be questioned about” [al-Isra’ 17:34]
“Verily, Allah commands that you should render back the trusts to those, to whom they are due” [al-Nisa’ 4:58]
So if keeping secrets is obligatory, then disclosing them is haram. 
The Prophet (peace and blessings of Allah be upon him) told a secret to ‘Aa’ishah and Hafsah and entrusted them with it, but they disclosed the secret, and Allah rebuked them for that. 
Allah said (interpretation of the meaning): 
“And (remember) when the Prophet  disclosed a matter in confidence to one of his wives (Hafsah), then she told it (to another i.e. ‘Aa’ishah). And Allah made it known to him; he informed part thereof and left a part. Then when he told her (Hafsah) thereof, she said: ‘Who told you this?’ He said: ‘The All-Knower, the All-Aware (Allah) has told me.’” [al-Tahreem 66:3]
Then Allah said (interpretation of the meaning): 
“If you two (wives of the Prophet: ‘Aa’ishah and Hafsah) turn in repentance to Allah, (it will be better for you), your hearts are indeed so inclined (to oppose what the Prophet likes); but if you help one another against him (Muhammad), then verily, Allah is his Mawlaa (Lord, or Master, or Protector), and Jibreel (Gabriel), and the righteous among the believers; and furthermore, the angels are his helpers” [al-Tahreem 66:4]
Then the Prophet (peace and blessings of Allah be upon him) withdrew from his wives for a month because of the secret that Hafsah had disclosed to ‘Aa’ishah. Al-Bukhaari, 5191. Ibn Hajar (may Allah have mercy on him) said concerning this hadeeth: This indicates that the one who discloses a secret may be punished in a fitting manner. 
In the Sunnah we find a warning against seeking out the secrets of others, and spreading secrets that should not be spread. 
For example, it is strongly discouraged to seek out the faults of others. According to a hadeeth narrated from Abu Hurayrah, the Messenger of Allah (peace and blessings of Allah be upon him) said: “If a man were to look into your private affairs without your permission, and you were to throw a pebble at him and put out his eye, there would be no sin on you.” Al-Bukhaari, 6902; Muslim, 2158. Ibn Hajar said, commenting on this hadeeth: It is narrated by Muslim with a different isnaad from Abu Hurayrah: “Whoever looks into some people’s house without their permission, it is permissible for them to put out his eye.” And it was narrated with yet another isnaad from Abu Hurayrah in a version that states it even more clearly; this is narrated by Ahmad, Ibn Abi ‘Aasim and al-Nasaa’i, and classed as saheeh by Ibn Hibbaan and al-Bayhaqi. This version says: “Whoever looks into some people’s house without their permission, and they put his eye out, there is no diyah (blood money) and no qisaas (retaliatory punishment).” And according to one report through this isnaad, “… and it is worthless.” 
Similarly there is the warning against the one who eavesdrops on the secrets of others. It was narrated from Ibn ‘Abbaas that the Prophet (peace and blessings of Allah be upon him) said: “Whoever eavesdrops on the conversation of other people when they do not want him (to listen), or they move away from him, molten lead will be poured into his ears on the Day of Resurrection.” Narrated by al-Bukhaari, 7042. 
The warning against spreading things that it is not permissible to spread includes condemnation of the one who spread marital secrets. He is regarded as being among the most evil of people before Allah. 
It was narrated that Abu Sa’eed (may Allah be pleased with him) said: The Prophet (peace and blessings of Allah be upon him) said: “Among the most evil of people before Allah on the Day of Resurrection will be a man who is intimate with a woman and she with him, then he spreads her secret.” Narrated by Muslim, 1437. 
According to another report narrated by Muslim, 1437, “One of the greatest trusts before Allah on the Day of Resurrection will be a man who was intimate with his wife and she with him, then he spread her secret.” What is meant by “one of the greatest trusts” is one of the greatest betrayals of trust. 
Among the advice given by the Arabs to new brides is: “Do not disclose his secret, for if you disclose his secret, you will make him hate you.”  
The secrets of the home should not be disclosed, and wise men and those who are religiously committed advise the one who knows a secret not to disclose it.  
It was narrated from Thaabit that Anas said: The Messenger of Allah (peace and blessings of Allah be upon him) came to me when I was playing with some other boys, and greeted us with salaam, then he sent me on an errand. I was late going home to my mother, and when I came she asked, ‘What kept you?’ I said, ‘The Messenger of Allah (peace and blessings of Allah be upon him) sent me on an errand.’ She said, ‘What did he need?’ I said, ‘It is a secret.’ She said, ‘Never disclose the secret of the Messenger of Allah (peace and blessings of Allah be upon him) to anyone.’ Anas said: ‘By Allah if I were to disclose it to anyone I would have disclosed it to you, O Thaabit.’
Narrated by Muslim, 2482. 
Disclosing secrets is one of the signs of hypocrisy, because it comes under the heading of betraying a trust. 
It was narrated from ‘Abd-Allah ibn ‘Amr that the Prophet (peace and blessings of Allah be upon him) said: “There are four qualities, whoever has all of them is a pure hypocrite, and whoever has some of them has a characteristic of hypocrisy until he gives it up: when he is entrusted with something he betrays that trust; when he speaks he lies; when he makes a promise he breaks it, and when he disputes he resorts to lies and falsehood.” Narrated by al-Bukhaari, 34; Muslim, 58. 
It is not a condition of a trust that the one who speaks these words must tell his listener that it is a secret that he should not tell anyone, rather it is sufficient for his manner to indicate that, such as if he takes him away from others to tell him, or when he tells him he looks around to see if anyone is listening, etc. 
Al-Tirmidhi (1959) narrated from Jaabir ibn ‘Abd-Allah that the Prophet (peace and blessings of Allah be upon him) said: “If a man tells you something then looks around, it is a trust.” Classed as hasan by al-Albaani in Saheeh al-Tirmidhi. 
And it says in Tuhfat al-Ahwadhi: 
“Then looks around” means looking to the right and the left out of caution. “It is a trust” means it is entrusted to the one to whom he spoke, i.e., it comes under the same rulings as a trust, so he must conceal it. Ibn Raslaan said: Because his looking around is the signal to the one to whom he is speaking that he is afraid that someone may overhear him, and that he has chosen him to tell his secret to. His looking around takes the place of his saying, ‘Listen to this and keep quiet about it because it is a trust (or a secret).’” 
And Allah knows best.