You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#63 introduced a new safe parsing function NewGitHubHost which ensures that the URL parsing is valid. Consumers of this library can use it in order to pass in Host in the OauthFlow configuration struct:
In #63, this parsing was changed to use the new function (which is great) but in doing so, some unintentional variable shadowing happened. Previously, the result of GitHubHost was assigned to the host variable which was used later on. Now the result of NewGitHubHost is assigned to host, err via short variable declaration (:=). This results in a new host variable being declared in the inner scope. Although we set oa.Host = host, the rest of the functions still use host, which results in a nil pointer deference.
Note that these tests aren't otherwise intended to pass (e.g. Device flow will panic for other reasons on an earlier commit), just to demonstrate the issue.
The text was updated successfully, but these errors were encountered:
Description
#63 introduced a new safe parsing function
NewGitHubHost
which ensures that the URL parsing is valid. Consumers of this library can use it in order to pass inHost
in theOauthFlow
configuration struct:oauth/oauth.go
Line 68 in afffc8e
However, it was possible to provide the deprecated
Hostname
string and both the device code and oauth flows would do the parsing internally. .In #63, this parsing was changed to use the new function (which is great) but in doing so, some unintentional variable shadowing happened. Previously, the result of
GitHubHost
was assigned to thehost
variable which was used later on. Now the result ofNewGitHubHost
is assigned tohost, err
via short variable declaration (:=
). This results in a newhost
variable being declared in the inner scope. Although we setoa.Host = host
, the rest of the functions still usehost
, which results in a nil pointer deference.Reproduction
Use these tests:
They will panic on:
oauth/oauth_device.go
Line 42 in afffc8e
oauth/oauth_webapp.go
Lines 36 to 37 in afffc8e
Note that these tests aren't otherwise intended to pass (e.g. Device flow will panic for other reasons on an earlier commit), just to demonstrate the issue.
The text was updated successfully, but these errors were encountered: