Sayyiduna Ubadah bin al-Samit (may Allah be pleased with him) narrated that the Messenger of Allah (peace and blessings be upon him) was speaking while the Companions (may Allah be pleased with them) were sitting around him: "Pledge allegiance to me that you will never associate anything with Allah, that you will not steal or commit fornication, that you will not kill your children, that you will not slander anyone, and that you will not disobey in matters of good. Whoever fulfils these promises, Allah will grant him the finest reward. If anyone commits any of these sins and is punished for it in this world, that will be an expiation for him; and if anyone's sin remains concealed, his matter rests with Allah: if He wills He will forgive him, and if He wills He will punish him." Sayyiduna Ubadah (may Allah be pleased with him) said: We pledged allegiance to him (peace and blessings be upon him) on that.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنايات / 15842