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

Reject known problematic env vars #308

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Reject known problematic env vars #308

merged 1 commit into from
Dec 17, 2024

Conversation

edmorley
Copy link
Member

We expose all env vars by default to subprocesses to allow for customisation of package manager behaviour - such as custom indexes, authentication and requirements file env var interpolation.

(An allow-list approach wouldn't work with all use-cases, plus wouldn't help the app at run-time.)

To improve the error UX (particularly during initial buildpack bootstrap, where failures would otherwise look like a problem with the buildpack and not the user inputs), the buildpack now rejects known problematic env vars that may break the build / the app.

The list of env vars was based on the env vars this buildpack sets, plus an audit of:

This also unblocks #265.

GUS-W-17454486.

We expose all env vars by default to subprocesses to allow for
customisation of package manager behaviour - such as custom indexes,
authentication and requirements file env var interpolation.

(An allow-list approach wouldn't work with all use-cases, plus
wouldn't help the app at run-time.)

To improve the error UX (particularly during initial buildpack
bootstrap, where failures would otherwise look like a problem with the
buildpack and not the user inputs), the buildpack now rejects known
problematic env vars that may break the build / the app.

The list of env vars was based on the env vars this buildpack sets,
plus an audit of:
- https://docs.python.org/3/using/cmdline.html#environment-variables
- https://pip.pypa.io/en/stable/cli/pip/#general-options
- https://pip.pypa.io/en/stable/cli/pip_install/#options

This also unblocks #265.

GUS-W-17454486.
@edmorley edmorley self-assigned this Dec 17, 2024
@edmorley edmorley marked this pull request as ready for review December 17, 2024 15:56
@edmorley edmorley requested a review from a team as a code owner December 17, 2024 15:56
@edmorley edmorley enabled auto-merge (squash) December 17, 2024 15:57
@edmorley edmorley merged commit ec1305f into main Dec 17, 2024
8 checks passed
@edmorley edmorley deleted the checks-forbidden-envs branch December 17, 2024 16:04
heroku-linguist bot added a commit that referenced this pull request Dec 18, 2024
## heroku/python

### Changed

- The build now fails early if known problematic Python and pip-related env vars have been set by the user or earlier buildpacks. ([#308](#308))
- The `PIP_PYTHON` env var is now only set at build time. ([#307](#307))

### Removed

- Stopped setting the `LANG` env var. ([#306](#306))
- Stopped setting the `PYTHONHOME` env var. ([#309](#309))
heroku-linguist bot added a commit to heroku/cnb-builder-images that referenced this pull request Dec 18, 2024
## heroku/python

### Changed

- The build now fails early if known problematic Python and pip-related env vars have been set by the user or earlier buildpacks. ([#308](heroku/buildpacks-python#308))
- The `PIP_PYTHON` env var is now only set at build time. ([#307](heroku/buildpacks-python#307))

### Removed

- Stopped setting the `LANG` env var. ([#306](heroku/buildpacks-python#306))
- Stopped setting the `PYTHONHOME` env var. ([#309](heroku/buildpacks-python#309))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants