Unless you arrive on a domestic flight, when you transfer you go through security. Standard practice based on the theory that Government B can never be too sure that Government A did the screening right in the first place, and should something happen on B's soil there'd be some serious questions to ask...