For much of our history, U.S. courts have granted the executive branch a great deal of leeway in determining the scope of this immunity because it is the executive branch that is responsible for international relations.
Because there, the courts have said under our Constitution that the executive branch's Constitutional authority - to answer the question of one of your previous callers - to protect classified information comes into direct conflict with the criminal defendant's right to a full and complete defense under a number of amendments to our Constitution.
Then of course, the third equal branch of government, the Judiciary, tests the constitutionality of laws through a myriad of circuit and appellate courts sometimes culminating into a landmark Supreme Court case.