Avoiding malware in recommendations? Occasionally, answers on this site include software recommendations. Let’s assume a "legitimate developer" pretends to have created a useful application that is (secretly) capable of doing harm. How can I be sure I do not install something that contains malicious code or a root kit, especially if it is closed-source software?
Sadly, malicious code can be so small and obfuscated in an infinite number of ways so you can't simply make a rule to test a package to tell if it's good or bad.

Statistically, people have established some guidelines like trying to know the source (typing in the web address directly and not trusting a link, not downloading it from an alternate site, insisting that it be code-signed and verifying the package check sum before installing executables), but these are indirect remedies. 

Apple maintains a page with links to most security information here:


https://ssl.apple.com/support/security/


Additionally, you could insist that all software that you run is signed by a legitimate developer to reduce the likelihood that someone has added a key logger to the game you just downloaded.

Lastly, after several delays, Apple has released GateKeeper to effectively sandbox software so that it has to explicitly list the things that it does (like access the address book, or modify files without user interaction) so that you can only let the system run code that obeys the sandbox rules. From a consumer perspective, you can prevent all code from running while you do whatever checks you feel are appropriate before allowing that code to run on your Mac.