Yeah, it's crucial to stop or limit that. Dr. Jim Green and colleagues from NASA have proposed placing a strong magnetic field at Sun-Mars L1, which in theory works. This recent The Planetary Society article on Mars terraforming covers that and comprehensive than the OP submission: https://www.planetary.org/articles/can-we-make-mars-earth-li...