Move the security checks to a layer?

Signed-off-by: emanuele <emanuele45@gmail.com>