Way to tell where a password dialog is coming from? Sometimes a piece of software will automatically update itself, and I'll abruptly get the "type your password to allow this" dialog. Is there any verification going on behind the scenes before the OS gives me this dialog? It seems like any random trojan could tell the OS that it's called "Update Adobe Flash Player" or something else official-sounding. For that matter, is there anything stopping a malicious program from popping up a dialog that looks just like the OS X one? 

I'm aware that programs shouldn't be able to do this unless I've knowingly put them on my computer, so the burden is on me to be careful about what software I download in the first place (barring discovery of new OS exploits, which is likely to happen at some point). I'd like to know whether there's any additional verification I could do so that even if malware does get onto my system, I can at least avoid giving it an admin password.
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: