-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Remove subprocess-environment allow list. #11743
Remove subprocess-environment allow list. #11743
Conversation
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
This was motivated by a need to propagate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think this should probably have a blocklist, particularly with PATH in it? Otherwise users can break things. Ditto on PYTHONPATH probably
@Eric-Arellano I don't follow. We already need PATH to even support binary discovery at all. PYTHONPATH is sealed off by Pex unless you configure it in with Pex knobs - some (all?) exposed by Pants. You or Stu should take this up if I'm missing something because I really haven't followed the handwringing around env vars well. |
I missed the discussion when the "allowlist" was initially added... but given that there is no way to wildcard env vars from the environment (and probably never will be...?), anything in this list has been explicitly added by a user, and I don't think it makes sense to limit things that have been explicitly added. Aside: pants/src/python/pants/engine/environment.py Lines 41 to 42 in 7a6a8df
|
Yes, but Pants sets PATH and we do not want to allow the user to configure that one. The behavior would depend on our merge strategy: if the user overrides Pants, then things will almost certainly break. If Pants overrides the user, the user setting will do nothing and people will be confused. An eager blocklist and good error message is better UX. Does that make sense? If so, I can put up a patch. You're right on PYTHONPATH - I think |
Mm. Yea, that probably makes sense... although dogfooding remote caching in the next few days will likely further shape this. If all we're trying to do is prevent someone from adding it to the list, I think that pants/src/python/pants/engine/environment.py Lines 41 to 42 in 7a6a8df
|
Where does Pants set PATH? But otherwise agreed and there is actually no question. The general principle being you only need to block configuration of things you yourself set to avoid trampling - this has nothing really to do with env cars in particular. |
pants/src/python/pants/engine/process.py Lines 551 to 558 in 43007bd
|
Aha. If that's the only example, then it's not a great one. We can be doing that (bootstrapping finding bash) differently. |
In fact, if that's the only example, it's a bad one. We should use a user specified PATH if present to find bash. |
Probably. But this gets to the fact that "subprocess environment PATH" is probably too coarse a setting. I'm skeptical that someone will want to set the same PATH for all tools, although they might want to set it for Allowing a different PATH to be set for |
[ci skip-rust]
[ci skip-rust] [ci skip-build-wheels]
Now
[subprocess-environment] env_vars
can be used to selectivelyallow arbitrary environment variables to be propagated to subprocesses.
[ci skip-rust]
[ci skip-build-wheels]