How does the Supreme Court balance individual rights and national security in cases of preventive detention?

The Supreme Court allowed Wangchuk’s wife to raise more grounds against his detention in Ladakh violence. I want to understand how the judiciary ensures that both personal freedom and security concerns are addressed fairly.