I didn't realize firefox could be downloaded inside of OS so I went online and found this code to type in the terminal.
sudo apt-get update && sudo apt-get install firefox
Is there any chance I got a malware version?
You actually did install Firefox the safe way inside the OS. However, you used the command line instead of a graphical frontend. So no worries, there is nothing wrong with your Firefox installation, both alternatives have the same result.
Under elementary OS / Linux often "there is more than one way to do it…"