Habeas corpus allows people to challenge unlawful detention – something the Homeland Security secretary appeared not to know