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 localhost to Allowed Loopback Addresses for Redirect URIs #1416

Open
Kanellaman opened this issue Apr 12, 2024 · 1 comment
Open

Add localhost to Allowed Loopback Addresses for Redirect URIs #1416

Kanellaman opened this issue Apr 12, 2024 · 1 comment

Comments

@Kanellaman
Copy link

Problem Description

The library currently supports loopback redirect URIs with the http scheme for the addresses 127.0.0.1 and ::1 without specifying a port, aligning with the best practices for OAuth2 applications on native devices as per RFC8252. However, the hostname localhost, which is commonly used and interchangeable with 127.0.0.1 in most development environments, is not explicitly supported. This can lead to slight confusion as developers are required to use IP addresses directly, which may not always be ideal, particularly in environments where localhost is prevalently used.

Proposed Change

I propose that we extend the validation logic to include localhost as a recognized hostname for loopback addresses. This change would allow developers to use localhost in redirect URIs without having to resort to numeric IP addresses, thus enhancing usability and consistency across different development setups.
Current Validation Line

Change to:

and parsed_allowed_uri.hostname in ["127.0.0.1", "::1", "localhost"]

Rationale

Including localhost in the list of valid loopback addresses would enhance the developer experience and align the library with common development practices where localhost is preferred over direct IP addresses. It's a minor change that could make the library more intuitive and user-friendly without compromising security or functionality, as localhost is effectively synonymous with 127.0.0.1 and ::1 within the context of loopback addresses.

Impact

This change would be backward-compatible, broadening the validation scope to include an additional, commonly used hostname. It will benefit developers by allowing more flexibility in redirect URI configurations without negatively impacting existing implementations.

@n2ygk
Copy link
Member

n2ygk commented May 20, 2024

Feel free to submit a small PR to add this. Make sure you include updated tests. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants