First off, we are advised to always install from the Ubuntu repos because there are tested. So when you install with
sudo from such a repo you can be assured it will only do what is expected of it.
Now that being said make sure you fully trust any repository you are adding to your system as ( based on the need to install certain files to the root location ) apps will need to have root permission to install into sensitive areas of your system.
Now a situation where you are advised not to install a package as root, would probably mean that it's a third party package and it's security isn't assured, and it can be corrupted while on transit to you and with this in turn will lead to the application gaining access to sensitive areas as a result of the root powers given to it via your
sudo command. Some packages are even kind enough to prevent you from installing as root in the first place, such apps will enforce such a doctrine of no sudo use (if I may call it that). My advice please take that advice.
Linux uses LSM (Linux Security Modules) to control what accesses what.
current LSMes are:
- SELINUX -- SECURITY ENHANCED LINUX
What the LSM does is to ensure that any process is limited to what it can access based on the current security policy governing that system. So give
sudo powers to an app is not enough, but care must be taken that you don't
sudo powers to the wrong apps as advised above.