The paper investigates the optimal scope of trade secrets law. In the model, one innovative firm invests resources first to produce knowledge, and then to protect it from unwanted disclosure. A rival firm invests to ferret out this knowledge. Trade secrets law affects this "secrecy contest" by reducing the probability of unwanted disclosure given the efforts of the parties. We show how optimal trade secrets policy depends on structural market features and cost parameters. In the final section, we consider the limit case in which the innovation lies on the face of the product, and derive the optimal scope of legal provisions preventing copycat imitation of products (unfair competition, passing off)