[AS7-6646] Factor out a common security utils module, remove a few hundred anon classes