It depends on your jurisdiction, of course, but I (as an American) wouldn't feel confident in the legality of buying Venezuelan government securities given https://www.state.gov/venezuela-related-sanctions/
Even if buying a bond issued by an unfriendly nation isn't illegal at a given moment, you might find yourself forced to divest if relations between your country and the issuer sour. I'm sure a few people who held Russian sovereign bonds lost their shirts when sanctions were levied and they had no choice but to dump their assets.
In the absolute worst case (e.g., if you held Japanese sovereign debt in December 1941 or Afghan sovereign debt in 2001), holding a bond might be grounds for you to be charged with treason or sponsoring terrorism.