How to handle Security blocking PyPi.org

I’m not sure what you’re specifically referring to, but there has been more than one instance of “legitimate package replaced with illegitimate package”

That said, blocking all of PyPI is definitely an overreaction here: following Secure installs - pip documentation v23.3.2 to enable hash-checking for pip is enough to mitigate these types of attacks (and other ‘malware’ attacks that depend on typosquats, etc).