On demand restricting for dangerous functions with a whitelist always enabled