Is it a national security concern if a foreign government knows a lot about your citizens?

There has been much talk in recent years about whether TikTok poses a national security threat to the US because it potentially gives the Chinese government access to information about a large number of US citizens.  But other social media platforms also potentially give the US access to information about non-US citizens. Is it a national security concern if a foreign government knows a lot about your citizens?