Having recently passed through LHR and JFK surely the security checks should be done just before anyone boards an aircraft.
I sat around in the duty free area where anybody could have done anything, no different than waiting for a bus. What matters is what actually gets on to an aircraft.
Checks should be done just before boarding then held in a secure area.
This would create time to investigate why someone checked in baggage, but hasn,t cleared security at the gate, rather than wait until everyone else is on board.