The books of Bukhari and Muslim narrated from many persons who were open enemies of Imam Ali (AS) like Imran Ibn Hattaan عمران بن حطان who was a Kharijite who praised Ibn Muljim the murderer of Imam Ali (AS). Huraiz Ibn Uthman Al-Himsi is also one of the narrators in Bukhari. He was also a well known enemy who was cursing Imam Ali (AS) from the pulpit. Tahtheb Al-Tahtheeb By Ibn Hajar Al-Asqalani 1:159.
There are many of such narrators you can find them in the books of Ilm Al-Rijaal.
The scholars of Ilm Al-Rijaal go through the books of history and Hadeeth and Rijaal and determine such narrators to avoid their narrations.
Bukhari who lived during the time of many Imams from Alul Bayt (AS) did not narrate any Hadeeth from Imam Jafar Al-Sadiq (AS) knowing hat he was the most prominent teacher of leading scholars of that time. On the other hand Bukhari narrated around one thousand Hadeeths from Ibn Shihab Al-Zohri who was a servant of Bani Umayyah.
Bukhari did not narrate from Fatimah , The daughter of the Prophet (SAWA) but just one Hadeeth, while he narrated from Abu Huraira more than six hundred Hadeeths.