The Messenger of Allah ﷺ, surrounded by a group of his companions, said, "Pledge allegiance to me that you will not associate anything with Allah, that you will not steal, that you will not commit adultery, that you will not kill your children, that you will not bring forth any slander you have fabricated between your hands and feet, and that you will not disobey me in what is right. Whoever fulfills this, his reward is with Allah. Whoever commits any of these and is punished for it, that punishment is an expiation for him. And whoever commits any of these and Allah conceals it, his affair rests with Allah. If He wills, He pardons him, and if He wills, He punishes him."Ahmad bin Saeed differed with him in this narration.
أخبرنا عبيد الله بن سعد بن إبراهيم بن سعد قال حدثني عمي قال حدثنا أبي عن صالح عن ابن شهاب قال حدثني أبو إدريس الخولاني أن
إن رسول الله ﷺ قال وحوله عصابة من أصحابه تبايعوني على أن لا تشركوا بالله شيئا ولا تسرقوا ولا تزنوا ولا تقتلوا أولادكم ولا تأتوا ببهتان تفترونه بين أيديكم وأرجلكم ولا تعصوني في معروف فمن وفى فأجره على الله ومن أصاب منكم شيئا فعوقب به فهو له كفارة ومن أصاب من ذلك شيئا ثم ستره الله فأمره إلى الله إن شاء عفا عنه وإن شاء عاقبه خالفه أحمد بن سعيد
Bukhari narrated it in the Book of Faith, chapter (11), hadith no. 18, and Muslim, in the Book of Hudud, chapter "Hudud Are Expiations for Their People," hadith no. 1709, from the hadith of Ibn Shihab Zuhri, through him. It is also in al-Kubra, hadith no. 7784.Umar is Yaqub, and Salih is Ibn Kaysan.