Headline is wrong. The decision does NOT say that the actions of the government were "A-OK".
In fact, the judges' ruling implicitly praised the plaintiffs for raising the issue, and criticized the government for trivializing it.
This was a narrow technical ruling that said that, because Congress did not put a waiver of sovereign immunity into the wiretapping law, people could not sue the government for monetary damages.
If someone had sued asking for a court order to bar the government from DOING this again, the court probably would have agreed.
And it's up to the executive branch to comply with laws, and up to Congress to change them if needed.
This decision specifically said that if you've been victimized, you can't sue for money. That's unfortunate, and Congress can change that, but it is not the same as saying that anything goes.
Sovereign immunity is a well established doctrine that goes back to English common law. You can't use the King's courts to collect money from the King.
And even today in our country, sovereign immunity applies unless it has been waived by law. Many waivers are written into the law, those cases are handled by the US Court of Claims.