Sahih al-Bukhari 6921
صحيح البخاري#6921SahihNarrated Ibn Mas`ud:A man said, "O Allah's Messenger (ﷺ)! Shall we be punished for what we did in the pre-Islamic Period of ignorance?" The Prophet (ﷺ) said, "Whoever does good in Islam will not be punished for what he did in the Pre-Islamic Period of ignorance and whoever does evil in Islam will be punished for his former and later (bad deeds)
Scholarly Authentication
We show the most cautious grade (weakest-wins) as the overall label. Individual scholars graded it as follows:
Every narration in Sahih al-Bukhari is accepted as Sahih (authentic) by the established status of the book.
In-book reference: 88:4