We analyze the distinguishability of two sources under adversarial conditions, when the error exponents of type I and type II error probabilities are allowed to take an arbitrarily small, yet positive, values. By exploiting the parallelism between the attacker's goal and optimal transport theory, we introduce the concept of Security Margin defined as the maximum average per-sample distortion introduced by the attacker for which the two sources can be reliably distinguished. We compute the security margin for some classes of sources and derive a general upper bound which is valid for any kind of sources assuming that the distortion is measured in terms of the mean square error between the original and the attacked sequences.