https://reddit.com/r/hongkong has a lot of discussion and footage of these guys coordinating with the police, including them getting into vehicles with mainland license plates.
The protesters are being subjected to the assaults rather than being the masked assailants.
My gut reaction is these attackers are from mainland China and who have been organised by an official in order to try and reduce HK's tendency to protest (a sentiment echoed in that article as well).
The protests are over a law allowing China to extradite people without any process.
Also government mass surveillance and identifying people who were recorded in public by a citizen commiting violence aren't the same thing. I wish I didn't have to explain this.
> The protests are over a law allowing China to extradite people without any process.
That is not true that there would not have been any process.
There would have been a full legal process like any extradition: I.e. extradition would have been requested based on a legal case, this would have been examined by a HK court with the 'accused' able to defend, then that HK court would have made a decision. [That's the actual bill]