A funeral procession passed by the Prophet ﷺ, and the deceased was spoken of favorably. He said, "It is confirmed."Then another funeral procession passed by him, and the deceased was spoken of unfavorably. He said, "It is confirmed."Someone asked, "Messenger of Allah, you said about this one 'It is confirmed,' and about that one 'It is confirmed.'"He replied, "It is the testimony of the people. The believers are Allah's witnesses on earth."
حدثنا أحمد بن عبدة حدثنا حماد بن زيد عن ثابت
مر على النبي ﷺ بجنازة فأثني عليها خيرا فقال وجبت ثم مر عليه بجنازة فأثني عليها شرا فقال وجبت فقيل يا رسول الله قلت لهذه وجبت ولهذه وجبت فقال شهادة القوم والمؤمنون شهود الله في الأرض
Bukhari narrated it in the Book of Testimonies, Chapter: How many are permissible for attestation of credibility?, Hadith: 2642, and Muslim narrated it in the Book of Funerals, Chapter: Regarding one who is praised or spoken ill of among the dead, Hadith: 949, from the hadith of Hammad bin Zayd, through the same chain.