The background checks one undergoes to receive a national security clearance can be intense. Investigators don't just care if you've ever been a communist, done drugs or run up your credit card bill; they want to know if you've cheated on your spouse, stolen something of value, or engaged in any assortment of deviant behaviors (at least by U.S. government standards).
They don't expect so-called "cleared" employees to be morally unimpeachable. Indeed, some go on to do morally questionable stuff, on superiors' orders. Investigators look for how a person could be blackmailed. They want to make sure you don't have secrets which, if discovered by a U.S. enemy, could make you manipulable.
"What if the person on the other end [of Doyle's online conversations] had been a member of al-Qa'ida or a similar terrorist organization and used this information to blackmail Mr. Doyle?" King asked in his press release. Granted, it's a long shot to believe al Qaeda could pick up a press secretary by posing online as a 12-year-old, or that a press secretary would be useful to them. But spying is a game of long shots -- and a Florida sheriff caught Doyle without too much trouble.
If a security check can't uncover pedophilic tendencies, it's not much good at all. It will be interesting to hear DHS explain how its security let three pedophiles join the agency -- even let one run its child sex crimes operation -- and what it's doing to change.