US Law forbids spying on US Citizens without a special warrant. However, spying on non-US citizens is fine. Sometimes, US citizens are caught communicating with foreign targets. Reports from those meetings or calls are given to people in the government, but because the law forbids spying on US citizens, the names of those citizens are blanked out ("masked").
It is possible to get the names of those US people when and if the report indicates a major problem (some sort of treasonous or criminal activity of great importance). Asking and receiving those names is called "unmasking". The unmasking is NOT revealing those names to the public. It is only revealing those names to the person who asked, and the person who asked must have a valid reason for unmasking, or it is not done.
There is nothing illegal about asking for names to be unmasked. It could be illegal if the materials do not meet any of the legal criteria for allowing unmasking. Unmasking is not revealing info the public. Revealing unmasked names to the public IS illegal.