Prevent falling from cliffs while attacking

How to block the player from falling off cliffs while doing attack moves that move forward?

Hello! Can you share some more details - what bp is used for character? Is attack movement generated with animation (by root motion) or with movement component itself (by movement input)?