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

[Net.ServicePointManager]::SecurityProtocol is Globally Modified by the Module #230

Closed
X-Guardian opened this issue Jun 9, 2020 · 3 comments · Fixed by #240
Closed

[Net.ServicePointManager]::SecurityProtocol is Globally Modified by the Module #230

X-Guardian opened this issue Jun 9, 2020 · 3 comments · Fixed by #240
Labels
in progress Work on this issue is already underway. Please don't work start new work on it. triage needed An issue that needs to be reviewed by a member of the team.

Comments

@X-Guardian
Copy link
Contributor

Issue Details

The [Net.ServicePointManager]::SecurityProtocol setting is getting globally modified by the execution of any resource function within the module.

Steps to reproduce the issue

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::SystemDefault
Write-Host ("Original SecurityProtocol value: " + [Net.ServicePointManager]::SecurityProtocol)
Get-GitHubRepository -OwnerName Microsoft -RepositoryName PowerShellForGitHub | Out-Null
Write-Host ("New SecurityProtocol value: " + [Net.ServicePointManager]::SecurityProtocol)

Verbose logs showing the problem

Original SecurityProtocol value: SystemDefault
New SecurityProtocol value: Tls12

Suggested solution to the issue

Modify the GitHubCore module and save/restore the value of the [Net.ServicePointManager]::SecurityProtocol property.

Requested Assignment

  • I'm just reporting this problem, but don't want to fix it.

Operating System

OsName               : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture       : 64-bit
WindowsVersion       : 1903
WindowsBuildLabEx    : 18362.1.amd64fre.19h1_release.190318-1202
OsLanguage           : en-GB
OsMuiLanguages       : {en-GB, en-US, th-TH}

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.0.1
PSEdition                      Core
GitCommitId                    7.0.1
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module Version

Running: 0.14.0
Installed: 0.14.0

@X-Guardian X-Guardian added bug This relates to a bug in the existing module. triage needed An issue that needs to be reviewed by a member of the team. labels Jun 9, 2020
@HowardWolosky HowardWolosky added help wanted Anyone in the community is welcome to do this work up for grabs Anyone in the community is welcome to do this work and removed bug This relates to a bug in the existing module. labels Jun 9, 2020
@HowardWolosky
Copy link
Member

Thanks for the report. Opening this up to the community as an easy fix.

@HowardWolosky HowardWolosky added the good first issue If you're new to the project (or to OSS in general) and you'd like to contribute, try this one. label Jun 9, 2020
@giuseppecampanelli
Copy link
Contributor

I'd like to tackle this

@HowardWolosky HowardWolosky added in progress Work on this issue is already underway. Please don't work start new work on it. and removed good first issue If you're new to the project (or to OSS in general) and you'd like to contribute, try this one. help wanted Anyone in the community is welcome to do this work up for grabs Anyone in the community is welcome to do this work labels Jun 11, 2020
@HowardWolosky
Copy link
Member

Awesome, thanks @themilanfan! Setting to in progress.

HowardWolosky pushed a commit that referenced this issue Jun 18, 2020
…ol (#240)

[Net.ServicePointManager]::SecurityProtocol is a global configuration that was being modified during the execution of `Invoke-GHRestMethod`.  With this change, the global state will be cached before the change and restored immediately afterwards.

Fixes #230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Work on this issue is already underway. Please don't work start new work on it. triage needed An issue that needs to be reviewed by a member of the team.
Projects
None yet
3 participants