There are multiple ways through which you can make your device safe before rooting. You can use the app permission option or run an antivirus. Some people also suggest that backing up the devices before rotting has proved to be very helpful. Moreover, it is recommended to remove the pre-installed apps or secure your network.