I heard the Messenger of Allah ﷺ say openly, not in secret, "The family of so-and-so are not my allies. My ally is only Allah and the righteous among the believers."
حدثنا محمد بن جعفر قال ثنا شعبة عن إسماعيل عن قيس بن أبي حازم
سمعت رسول الله ﷺ جهارا غير سر يقول إن آل أبي فلان ليسوا لي بأولياء إنما وليي الله وصالح المؤمنين
Its chain of transmission is sahih, and it is found in similar form in Bukhari 8/7, Al-Shab edition, in the book of manners, on maintaining kinship ties even when reciprocity is lacking, and in Abu Awana 1/96, in the book of faith.