Well, for one thing, this is considered a Border Search. Border Searches are not just done on the Southern and Northern Borders. Every, International Airport, in the United States is considered a border location. Only until you have your passport and visa checked/approved and you clear Customs, are you considered in the United States. Until then, you might as well be on the Mexican side of the border, waiting to get into Texas.
Because of that, the law, upheld by SCOTUS, allows “warrantless searches” at Border Crossings or entry into the US. Neither CBP, nor ICE, needs Probable Cause to search Charles’ bag, yours or mine.
“Every, International Airport, in the United States is considered a border location.”
As well as a few in Canada. I flew through Canada once on Canadian, and went through entry via US Customs and Immigration authorities in Vancouver. I flew from Canada on Air Canada and went through entry in Toronto. It allows the onward flight to proceed to a domestic terminal.
I’ve heard some people remark that international airports in small cities are aggrandizing themselves by calling themselves “international”. “Podunk Corners International Airport”. “International” means that there are customs and immigration facilities there.