Do I understand correctly that the best way to make sure is to go through module’s code and see for myself?
Yes.
When you install Python modules through PIP, you are installing any code contained within those modules. And note that Python modules allow code execution not only at run time, but also at install time. To prevent this, only install binary distribution Python wheels using the --only-binary :all:
flag. This avoids arbitrary code execution on installation (by avoiding setup.py
).
In addition to this, you can also help mitigate against malicious packages by:
--user
flag.--require-hashes
flag.