"If a spy's activities are leaked before they are to begin, the spy and those who know should be put to death." Sun Tzu
In fact, when we were writing our Sonshi Art of War edition, The Art of War--Spirituality for Conflict, this passage was the most difficult we had to explain. The concept seemed to go against the benevolent warrior Sun Tzu is famous for. It wasn't that we were unaware of the realities of war, especially in ancient China -- it was because we were viewing his advice through our own modern eyes and our modern upbringing.
And why not. If The Art of War is truly timeless, Sun Tzu's wisdom should stand the test of time. So let's examine his verse in more detail.
If the spy is exposed and those who are aware of this exposure are all put to death, I would surmise this decision must prove itself to be more favorable than all other dire alternatives. Sun Tzu thought this way because much like his advice to "lay siege to a city only when other options are not available," he always was inclined to make the least net costly decision. There isn't one example in The Art of War where Sun Tzu advised a more costly path in lives or treasure.
That means, then, the exposure of the spy and those who know would mean the death of more people if they are allowed to live. Given the turbulent late Spring and Autumn period in China, that exposure might very well mean risking the survival of an entire nation.
Let's look at a more modern ethical problem. Should the bus driver transporting soldiers critical to saving a city from attack run over a child who suddenly ran across the street -or- avoid the child but crash into a building killing everyone inside the bus? It is an ethical problem because there is no right answer. Some people would say save the child because no one should purposefully kill an innocent person, especially a child. Some would say run the child over because more lives would be saved.
The key here is to have thought carefully about difficult ethical dilemmas and scenarios in case you would have to face them in real life. You can do this for high potential situations that might arise but haven't happened yet. When you have deliberated upon a likely difficult situation, you can make an immediate decision when you encounter it, instead of trying to make the best decision impromptu.
There are people I know who doubt ethics classes can help people make better ethical decisions. They say it is too late to teach them right and wrong. However, the idea behind these classes isn't to teach people right from wrong. The idea is to allow the student to analyze and deliberate on what best to do in case difficult ethical problems arise.
I believe the reason why people most of the time choose a regrettable path is because they haven't thought about the problem sufficiently prior to making a decision. They are caught by surprise. (Sun Tzu in his Art of War discussed about surprise attacks and would say those caught by surprise are at a clear disadvantage.) Unfortunately once the choice has been made, it is now too late. With ethics classes, he or she would be better prepared.
As evidenced by The Art of War, Sun Tzu thought deeply about what to do in situations of war. In the case of managing spies, it is no different. Such careful deliberation would be beneficial for any person, company, or nation.