How is `pub/health_check.php` used?

How to prevent an infection of pub/health_check.php in 2.3.3-p1 ≤ Magento ≤ 2.3.7-p2 and 2.4.0 ≤ Magento ≤ 2.4.3-p1?