There was a prior issue on pip where running the pip install command against a wheel could cause arbitrary code execution: #13079
However while that specific issue was fixed it was not addressed if there was any other approach that could cause this. One solution is to implement a mechanism to prevent imports from happening at a certain point, then we can confidently lazily import modules without having to worry if we introduce an arbitrary code execution issue in pip.
For some more context, although not directly relevant to whether this is an issue or not, I brought this up as part of the discussion on PEP 810, as that PEP introduces a feature that can force imports to be lazy. The initial suggestion, and what got wrote up in the PEP, is to have a mechanism that forces all users to be explicit, regardless of whether they are marked as lazy or not. It turned out that mechanism had a lot of downsides as discussed on DPO, but that discussion also made clear that that solution wasn't required, and more what pip should do is make sure it is enforcing it's assumptions about how imports work.
There was a prior issue on pip where running the
pip installcommand against a wheel could cause arbitrary code execution: #13079However while that specific issue was fixed it was not addressed if there was any other approach that could cause this. One solution is to implement a mechanism to prevent imports from happening at a certain point, then we can confidently lazily import modules without having to worry if we introduce an arbitrary code execution issue in pip.
For some more context, although not directly relevant to whether this is an issue or not, I brought this up as part of the discussion on PEP 810, as that PEP introduces a feature that can force imports to be lazy. The initial suggestion, and what got wrote up in the PEP, is to have a mechanism that forces all users to be explicit, regardless of whether they are marked as lazy or not. It turned out that mechanism had a lot of downsides as discussed on DPO, but that discussion also made clear that that solution wasn't required, and more what pip should do is make sure it is enforcing it's assumptions about how imports work.