Skip to content

[v13] Filter dangerous environment variables before reexec#34275

Merged
jentfoo merged 1 commit intobranch/v13from
jent/exec_env_filter-v13
Nov 7, 2023
Merged

[v13] Filter dangerous environment variables before reexec#34275
jentfoo merged 1 commit intobranch/v13from
jent/exec_env_filter-v13

Conversation

@jentfoo
Copy link
Copy Markdown
Contributor

@jentfoo jentfoo commented Nov 6, 2023

Backport #34177 to branch/v13

* Filter dangerous environment variables before reexec

This change filters potentially dangerous environment variables that could result in code execution.

This seemed safest to integrate as a new struct within the `environment.go` in utils.  This struct allows us to validate variables as they are built, making sure that regardless of the source we have validated them against our filter list.

The environment specific logic was significant enough that the current and new logic was refactored into a new package `envutils`.

* Allow the easy addition of execution environment into SafeEnv

In addition this commit adds in a check to look for duplicate keys which may be attempting to overload our set values.

* Apply PR Feedback and remove env duplicate handling

* Apply additional PR feedback
@jentfoo jentfoo added this pull request to the merge queue Nov 7, 2023
Merged via the queue into branch/v13 with commit 62655a6 Nov 7, 2023
@jentfoo jentfoo deleted the jent/exec_env_filter-v13 branch November 7, 2023 20:47
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.

3 participants