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

Add support for PKCE #136

Merged
merged 18 commits into from
Jul 6, 2022
Merged

Add support for PKCE #136

merged 18 commits into from
Jul 6, 2022

Conversation

andyrzhao
Copy link
Collaborator

  • Adds PKCE params to fetch code-path, using helper function from pkce.go.
  • Updates go mod version to 1.16 since the latest version of oauth2 core lib has a dependency on 1.16 API. Update vendors.
  • Ensure hostname is fully specified (i.e. localhost:8080 instead of :8080) in cli_test.go and loopback.go, to avoid a MacOS security pop-up.

@@ -309,10 +309,10 @@ func getListener(address string) (listener *net.Listener, serverAddress string,

if match == "" { // Case: No given port provided for localhost
// Creating a listener on the next available port
l, err = net.Listen("tcp", ":0")
l, err = net.Listen("tcp", "localhost:0")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation. From the documentation it looks like they do not recommend having a hostname. The documentation can be found here: https://pkg.go.dev/net#Listener. In short, this is what it says:

The address can use a host name, but this is not recommended, because it will create a listener for at most one of the host's IP addresses.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions. I reviewed the official documentation and feel like the recommendation does not explicitly discourage localhost, but rather discourage a hard-coded fqdn, which may vary depending on where the code is deployed. So this should not be an issue for our use-case.

} else { // Case: Port provided for localhost
// Creating a listener on the provided port
l, err = net.Listen("tcp", strings.Replace(match, "localhost", "", 1))
Copy link
Collaborator

@ulisesL ulisesL Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this. Maybe the same (please see comment above) can be applied here.

Copy link
Collaborator

@ulisesL ulisesL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andy, thanks for making these many changes. I put a few comments for you to consider. Thanks again!

@ulisesL
Copy link
Collaborator

ulisesL commented Jul 1, 2022

LGTM

@andyrzhao andyrzhao merged commit 0d7480f into google:master Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants