Pretty questionable, I'd have thought. Can security effectively detain people without their consent, particularly when there is (as yet) no clear evidence of a crime?
I guess they could always threaten anyone who leaves with being fired for refusing to submit to a security check.
Of course security can temporarily detain you. If they see you walking home with some pens, they can do that. Much more easily if they catch you taking out a prototype. It's called theft. I imagine during the temporary detainment -- no handcuffs or anything, but running out wouldn't help your employment record -- top level execs would be called to ask what to do. They can, very definitely, call the cops if something is criminal. Otherwise, it's everywhere from something on your record to dismissal. Or a talking-to by Steve. I think I'd take the cops.