Most of the GPIO pins on STM32 MCUs are 5V tolerant. A STM32 can not run on a 5V supply but it will accept a 5V on input pins without frying.