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

[Bug] HTTP(S)_PROXY env vars modification by Invoke-Git leak to current session #5435

Closed
chawyehsu opened this issue Mar 17, 2023 · 0 comments · Fixed by #5424
Closed

[Bug] HTTP(S)_PROXY env vars modification by Invoke-Git leak to current session #5435

chawyehsu opened this issue Mar 17, 2023 · 0 comments · Fixed by #5424
Labels

Comments

@chawyehsu
Copy link
Member

chawyehsu commented Mar 17, 2023

Bug Report

HTTP(S)_PROXY env vars are updated to apply proxy config for git during the invocation of Invoke-Git. Ideally, the change of these env vars should not remain in the current session. The implementation of Invoke-Git does have a snippet of code to try to reset the env vars.

Scoop/lib/core.ps1

Lines 158 to 159 in a20bb4f

$old_https = $env:HTTPS_PROXY
$old_http = $env:HTTP_PROXY

Scoop/lib/core.ps1

Lines 173 to 176 in a20bb4f

finally {
$env:HTTPS_PROXY = $old_https
$env:HTTP_PROXY = $old_http
}

Unfortunately, it is not parallel execution safe. Parallel execution of Invoke-Git such as updating buckets parallelly will read and write the same shared env var and lead to a data race, making it unable to revert the env var modification.

Current Behavior

develop branch

# start up a new powershell session
$ $env:HTTP_PROXY
# [no proxy]
$ scoop update
Updating Scoop...
Updating Buckets..
$ $env:HTTP_PROXY
# <proxy>

Expected Behavior

no env vars modification leak

Additional context/output

Possible Solution

implement parallel execution safe for Invoke-Git.

System details

Windows version: [e.g. 7, 8, 10, 11]

OS architecture: [e.g. 32bit, 64bit, arm64]

PowerShell version: [output of "$($PSVersionTable.PSVersion)"]

Additional software: [(optional) e.g. ConEmu, Git]

Scoop Configuration

//# Your configuration here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants