Skip to content

Commit

Permalink
Kill SETTABLE_ENV_VARS allow list. (#11743)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois authored Mar 19, 2021
1 parent 065fd11 commit d46197d
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 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,12 +48,7 @@ async def get_subprocess_environment(
subproc_env: SubprocessEnvironment,
) -> SubprocessEnvironmentVars:
return SubprocessEnvironmentVars(
await Get(
Environment,
EnvironmentRequest(
subproc_env.env_vars_to_pass_to_subprocesses, allowed=SETTABLE_ENV_VARS
),
)
await Get(Environment, EnvironmentRequest(subproc_env.env_vars_to_pass_to_subprocesses))
)


Expand Down

0 comments on commit d46197d

Please sign in to comment.