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

Use the Bash binary in PATH for parsing recipes #336

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

matteodelabre
Copy link
Member

Our current Python code spawns a Bash process as part of the recipe parsing process. To make sure the calling environment does not influence how the recipe is parsed, the subprocess is created with a clean environment. Unfortunately, this means the PATH variable is cleared and therefore that the subprocess may use a Bash binary different from the one in the user’s PATH. This PR changes that behavior and forwards the PATH value to the subprocess.

See the following comment and its follow-ups for more context: #324 (comment)

Test plan: Added a dummy bash binary (a file containing only #!/usr/bin/env false) to my PATH and checked that the recipe parsing fails (indicating that it invokes the dummy Bash and not the system one). Without the current PR, the parsing succeeds even if the parent PATH points to the dummy Bash.

Our current Python code spawns a Bash process as part of the recipe
parsing process. To make sure the calling environment does not influence
how the recipe is parsed, the subprocess is created with a clean
environment. Unfortunately, this means the PATH variable is cleared and
therefore that the subprocess may use a Bash binary different from the
one in the user’s PATH. This PR changes that behavior and forwards the
PATH value to the subprocess.

See the following comment and its follow-ups for more context:
<#324 (comment)>

Test plan: Added a dummy `bash` binary (a file containing only
`#!/usr/bin/env false`) to my PATH and checked that the recipe parsing
fails (indicating that it invokes the dummy Bash and not the system
one). Without the current PR, the parsing succeeds even if the parent
PATH points to the dummy Bash.
@matteodelabre matteodelabre added the tooling Set of scripts and configuration files for building the packages label Apr 8, 2021
@matteodelabre matteodelabre merged commit cc2f0d1 into testing Apr 9, 2021
@matteodelabre matteodelabre deleted the tooling/fix-bash-path branch April 9, 2021 08:25
danshick pushed a commit to danshick/toltec that referenced this pull request May 5, 2021
Our current Python code spawns a Bash process as part of the recipe parsing process. To make sure the calling environment does not influence how the recipe is parsed, the subprocess is created with a clean environment. Unfortunately, this means the PATH variable is cleared and therefore that the subprocess may use a Bash binary different from the one in the user’s PATH. This PR changes that behavior and forwards the PATH value to the subprocess.

See the following comment and its follow-ups for more context: <toltec-dev#324 (comment)>

Test plan: Added a dummy `bash` binary (a file containing only `#!/usr/bin/env false`) to my PATH and checked that the recipe parsing fails (indicating that it invokes the dummy Bash and not the system one). Without the current PR, the parsing succeeds even if the parent PATH points to the dummy Bash.
danshick added a commit to danshick/toltec that referenced this pull request May 5, 2021
LinusCDE pushed a commit that referenced this pull request Jun 3, 2021
Our current Python code spawns a Bash process as part of the recipe parsing process. To make sure the calling environment does not influence how the recipe is parsed, the subprocess is created with a clean environment. Unfortunately, this means the PATH variable is cleared and therefore that the subprocess may use a Bash binary different from the one in the user’s PATH. This PR changes that behavior and forwards the PATH value to the subprocess.

See the following comment and its follow-ups for more context: <#324 (comment)>

Test plan: Added a dummy `bash` binary (a file containing only `#!/usr/bin/env false`) to my PATH and checked that the recipe parsing fails (indicating that it invokes the dummy Bash and not the system one). Without the current PR, the parsing succeeds even if the parent PATH points to the dummy Bash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Set of scripts and configuration files for building the packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants