Legally, the national security component is relatively minor to the case. It's played up to be the justification for the law but SCOTUS doesn't really get to decide whether that is good justification or even correct.
SCOTUS doesn't really get to decide whether that is good justification or even correct
They do, and they did. From the ruling:
The Act’s prohibitions and divestiture requirement are designed to prevent China—a designated foreign adver- sary—from leveraging its control over ByteDance Ltd. to capture the personal data of U. S. TikTok users. This ob- jective qualifies as an important Government interest un- der intermediate scrutiny.
> The nation’s highest court said in the opinion that while “data collection and analysis is a common practice in this digital age,” the sheer size of TikTok and its “susceptibility to foreign adversary control, together with the vast swaths of sensitive data the platform collects” poses a National Security Concern.
FTA