Skip to content
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

Kill SETTABLE_ENV_VARS allow list. (cherrypick of #11743) #11791

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions src/python/pants/core/util_rules/subprocess_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,6 @@
from pants.option.subsystem import Subsystem
from pants.util.frozendict import FrozenDict

# Names of env vars that can be set on all subprocesses via config.
SETTABLE_ENV_VARS = (
# Customarily used to control i18n settings.
"LANG",
"LC_CTYPE",
"LC_ALL",
# Customarily used to control proxy settings in various processes.
"http_proxy",
"https_proxy",
"ftp_proxy",
"all_proxy",
"no_proxy",
"HTTP_PROXY",
"HTTPS_PROXY",
"FTP_PROXY",
"ALL_PROXY",
"NO_PROXY",
# Allow Requests to verify SSL certificates for HTTPS requests
# https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification
"REQUESTS_CA_BUNDLE",
)


# TODO: We may want to support different sets of env vars for different types of process.
# Can be done via scoped subsystems, possibly. However we should only do this if there
Expand All @@ -51,8 +29,7 @@ def register_options(cls, register):
help=(
"Environment variables to set for process invocations. "
"Entries are either strings in the form `ENV_VAR=value` to set an explicit value; "
"or just `ENV_VAR` to copy the value from Pants's own environment.\n\nEach ENV_VAR "
f"must be one of {', '.join(f'`{v}`' for v in SETTABLE_ENV_VARS)}."
"or just `ENV_VAR` to copy the value from Pants's own environment."
),
)

Expand All @@ -71,9 +48,7 @@ def get_subprocess_environment(
subproc_env: SubprocessEnvironment, pants_env: PantsEnvironment
) -> SubprocessEnvironmentVars:
return SubprocessEnvironmentVars(
pants_env.get_subset(
subproc_env.env_vars_to_pass_to_subprocesses, allowed=SETTABLE_ENV_VARS
)
pants_env.get_subset(subproc_env.env_vars_to_pass_to_subprocesses)
)


Expand Down