Way to tell where a password dialog is coming from?
In System Preferences you go to Security and Privacy.

Code signing is a component of this.  Choosing Mac App Store and Identified developers requires the use of Code Signing certificate.  If you want to be able to install anything unsigned, you will have to select "Anywhere."  This allows you to install anything, but it allows you to install anything :) See this pic: