How to safely insert USB stick/device to Linux computer?
Install USBGuard — it provides a framework for authorising USB devices before activating them. It can pop up a notification when you connect a new device, asking you what to do; and it can store permanent rules for known devices so you don’t have to confirm over and over. Rules are defined using a comprehensive language with support for any USB attribute (including serial number, insertion port...), so you can write rules that are as specific as you want — whitelist this keyboard if it has this identifier, this serial number, is connected to this port, etc.
To complete the other answer, it should be known that you can never completely protect a computer from malicious USB devices. There have been several proof-of-concept and commercially available devices such as the USB Killer which can literally fry the port or the motherboard.
Software will never be able to protect from this, and there's always a chance it can be vulnerable. If you really need strong protection, make the ports physically inaccessible (think ATMs, for example).