I can only point to the ISC2 Code of Ethics, in which Canon II says the following:
"Act honorably, honestly, justly, responsibly, and legally."
The order of the words here matters greatly and was carefully considered when drafting the CoE. To be ethical, an action by a professional does not need to be legal. If the professional has considered whether the act is honorable, honest, just, and/or responsible, it can be perfectly ethical while being completely illegal.
I do not think that we need more than Canon II to cover the debated scenarios. I also seriously doubt that this will become an issue outside of government business any time soon. I don't see the US government handing out the digital equivalent of letters of marque any time soon.