This is a very grey area, and until somebody actually challenges these searches and gets a ruling from a court there is not much you can do other than turn around and leave the station. Under New York case law (People v. DeBour) there are four levels of permissible police intrusion. (1) The police have the right to approach a citizen to request information when there is some objective credible reason for that interference, although not indicative of criminality (which can be practically anything). (2) The police can then intrude upon a person’s privacy to a greater degree and can obtain explanatory information by means short of a forcible seizure if there is founded suspicion that criminal activity is afoot. (3) An officer can forcibly stop and detain a person when the officer has a reasonable suspicion that the person has committed, is committing or is about to commit a felony or a misdemeanor. (4) If the officer stops and detains a person and then entertains an independent and reasonable suspicion that he is in physical danger because the detainee is armed, the officer may frisk the detainee. De Bour has been expanded upon and interpreted many different ways throughout the years. I think the random bag search falls somewhere between level (2) and (3), but the legality of it is definitely questionable.