Not just during the world wars. British intelligence apparently faced the same dilemma when infiltrating the IRA, and some of the results were quite ugly (look up Stakeknife if you're interested).
Very true. Though Stakeknife was also used in a way to remove hardline individuals seen as problematic to the more pragmatic parts of the Republican movement who were open to negotiate and protect other sources higher up. With obviously terrible consequences for many innocent people.