security model compilation fix

Fixes #2260

It's a bit over-engineered, but I think it'll prove useful for collecting similar methods as they are found.