I have a hypothetical question. Suppose someone is flying from a country where a medicine, such as Codeine, is perfectly legal, to a country where Codeine is also perfectly legal. However, the flight has to be split at a hub airport such as Dubai, where codeine is a banned substance because it is derived from opiates. If the passenger stays air-side, then can the baggage be searched for banned substances in Dubai, even though the passenger is not technically entering UAE, but just passing through as a transit passenger?
If the passenger stays air-side, then can the baggage be searched for banned substances in Dubai, even though the passenger is not technically entering UAE, but just passing through as a transit passenger?
Yes. The passenger is on United Arab Emirates soil and specifically within the Emirate of Dubai. He is subject to their authority.
If instead of codeine in the suitcase he was transporting 100 kg of market-quality uncut heroin, I think it's pretty clear that the authorities in Dubai would not let the matter slide on some jurisdictional whim.
passenger is not technically entering UAE
The passenger is not seeking entry for immigration purposes while he remains in the transit area. But that does not mean he is somehow in a lawless zone outside of the control of the host state.
Now we are clear that in principle the state is entitled to enforce its laws within the airport, the more pertinent question is, will it?
Passengers within the international zone are often exempt from laws regarding possession of certain medications for personal use, because such a small quantity passing through a sterile, separate area usually poses no threat to the host state.
In particular, Dubai depends on its reputation for being a good place to connect, and upsetting travelling westerners over possession of small quantities of prescription drugs is probably not worth the time, money or reputation cost. Therefore people in the airport (and other ports) might be exempt from these laws until they apply for entry.
But that is a matter you have to check on an individual basis for each country.