I'll add very quickly that obviously states under international law have an obligation to provide public security, but laws like national security legislation are meant to be necessary, narrow and proportionate. The national security law and other Chinese government policies are none of those things. Those laws also cannot undercut key human rights commitments or target an entire population.
The Chinese government has plenty of existing laws to prosecute credible threats to national security should it need to do that. Many of those laws are deeply problematic, but policies such as the strike hard campaign in Xinjiang or the national security law in Hong Kong go wildly beyond what is necessary, narrow, proportionate or reasonable.