A few bad apples is a great idiom though that applies to so many places. For examples, teachers often report that more than 2 troublemakers in a classroom ruins the entire class. A few bad cops destroy trust in all policemen, ruining the the entire force, et cetera.
And more relevant to us, a couple bad lines of code sprinkled in the millions in your code base can ruin the entire thing....