Planetary protection in the extreme environments of low-mass stars