-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] Add a way to enforce static evaluation of attr: #2901
Comments
Isn't it always possible to cause code execution during builds according to PEP 517 by setting I suppose the only safe way of not having code execution is to install the pre-compiled wheel... |
To clarify, the default behavior of attrs is to load statically, and it's only the fallback behavior that would enable code execution. Acknowledged, a maliciously-crafted module could easily trigger the arbitrary code execution. Privately, someone asked if this issue was a security vulnerability. Here's my response.
Instead of focusing on a specific missed expectation (attrs), this project would first need to step back and decide if build/install without code execution general is a desirable and possible goal to work toward. Would you agree there's little value in plugging this hole if there are many other larger holes that cannot be plugged? Avenues of code executionWhile not exhaustive, here are some current avenues of code execution available when building a Setuptools-based project:
If the goal is to prevent arbitrary code execution during build time, limiting the attrs directive is probably the least of these challenges. Some of these are Setuptools-specific and others are inherent in the language or the packaging ecosystem. DesignWhat is the broader problem @KOLANICH wishes to solve? Under what conditions is it necessary (and not) to prevent code execution? |
Yeah, a low-hanging fruit.
So the roadmap IMHO should be the following:
No. A journey of a thousand miles begins with a single step. |
You make a compelling argument, which I will summarize as: arbitrary code executing during building is worth solving and Setuptools should aim to limit whatever avenues to arbitrary execution that are inherent in Setuptools' own logic. If Setuptools wants to take this stance, I'd like to critique the proposed solution. In particular, it creates this scenario:
@KOLANICH My preference would be to deprecate the arbitrary code execution fallback and rely on the behavior introduced in #1753. Would you be willing to take on the implementation? |
Would forward compatibility be a problem? I mean would older versions of
Untill the defaults are swapped. My idea was the following
I aggree, this is better.
I have no ETA on that. I would be glad if someone else did it. |
Hey! Just wondering if anyone is working on this issue? |
IDK about other people, but I am currently NOT. |
What's the problem this feature will solve?
It is possible to cause code execution in pure
setup.cfg
+pyproject.toml
workflows at wheel build stage.Describe the solution you'd like
options.no_exec = true
intosetup.cfg
which semantics is to disable as many mechanisms of execution of code supplied by package author at the build stage as possible.attr
for now when it is enabled. Other hardenings can be done in other PRs.Alternative Solutions
Do it by default for
setup.cfg
+pyproject.toml
packages, it's the main feature of such a way to build packages anyway.Code of Conduct
The text was updated successfully, but these errors were encountered: