In this paper we study the decision of a firm to undertake a one-time proactive preventive investment to limit the occurrence of future disruptions. The firm is operating in a market with uncertain demand, and its products are subject to a risk of malfunction. Malfunctions lead to direct costs, consisting of, e.g. legal fees, fines and additional costs. But they also make the product less attractive, affecting product demand. Moreover, the firm may be strictly or partially liable for these malfunctions. In order to take into account different levels of liability, we introduce a liability parameter. Our model takes these features into consideration, and we determine the optimal time and size of the preventive investment, depending on the liability rule, that maximize the value of a firm that is already in the market and has the option to invest in a preventive infrastructure. We then determine the liability rule that steers this investment decision in such a way that malfunction damage is minimized.