In our daily lives, we rely on the proper functioning of supply networks, from power grids to water transmission systems. A single failure in these critical infrastructures can lead to a complete collapse through a cascading failure mechanism. Counteracting strategies are thus heavily sought after. In this article, we introduce a general framework to analyse the spreading of failures in complex networks and demonstrate that both weak and strong connections can be used to contain damages. We rigorously prove the existence of certain subgraphs, called network isolators, that can completely inhibit any failure spreading, and we show how to create such isolators in synthetic and real-world networks. The addition of selected links can thus prevent large scale outages as demonstrated for power transmission grids.