Like so many others before you, you (again) make the erroneous assumption that rights under the Constitution are absolute. They're not. For one thing, they're frequently in conflict with one another; so something's got to give.
Furthermore, national defense is clearly the paramount purpose of the federal government, and there will inevitably be conflicts between individual rights and the responsibility of the government to defend the country. Clearly, something's got to give, and it simply cannot always be national security.
Unfortunately, there's a tradeoff between security and freedom, and I'm not aware of anyone who is willing to trade away ALL security for maximum freedom.