Many countries have national laws prohibiting cooperate espionage, but it's not necessarily prohibited by international law absent a declaration of war.