Whether it is legal and, assuming it was legal, whether I would think it was legitimate would depend on exactly what was done and why. But the answer to your second question seems obvious: if it is currently legal for the government to do it and you think it ought not to be then lobby Congress and/or your state legislature to make it illegal.

