LPS-37055

Hi @rotty3000 

I hope you don't mind that I send you this PR. It's for the topic we talked - see last commit.

I also refactored whitelist check & security check to deduplicate the code (first 5 commits :D )

Thank you.