The Prophet ﷺ said, "Do not keep company with anyone but a believer, and let none eat your food but the pious."
عن النبي ﷺ قال: لا تصاحب إلا مؤمنا، ولا يأكل طعامك إلا تقي.
Narrated by Abu Dawud (4832), Tirmidhi (2395), Ahmad (11337), Darimi (554), and Hakim (4/128), all through the route of Haywa bin Shurayh, from Salim bin Ghaylan, from Walid bin Qays, from Abu Saeed Khudri, who mentioned it.Some versions report it with uncertainty, from Salim, from either Walid bin Qays or Abu Haytham, from Abu Saeed Khudri. Its chain is hasan because of Salim bin Ghaylan, whose hadith is hasan. Walid bin Qays is Tujibi Misri, from whom a group of narrators reported. Ajli graded him trustworthy, and Ibn Hibban listed him among the trustworthy narrators, so someone like him has his hadith graded hasan outside of matters of legal rulings, even though Salim was uncertain whether it was him or Abu Haytham, who is Sulayman bin Amr Misri, a trustworthy narrator.Tirmidhi graded it hasan, saying, "This is a hasan hadith, we only know it through this route."His statement, "Let none eat your food except one who is righteous," refers to food offered at a general invitation, with exceptions made for the rights owed to neighbors and relatives, those in need, and those whose harm is feared.