Supreme Court says migrants can bring detention challenge to judge