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

Allow port numbers to be used in local host names. e.g. localhost:8888. #5318

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

aaron13100
Copy link
Contributor

Allow port numbers to be used in local host names. e.g. localhost:8888.

Background

There are scenarios where local development or specific server configurations require non-standard ports to be used in conjunction with hostnames such as localhost. The current implementation of check_local_file_access does not allow for URLs with such ports, making it inconvenient or impossible for developers and users to utilize the software in some local environments. This pull request updates the function to be more accommodating to such URLs, enhancing the tool's flexibility.

Changes 🏗️

Modified the check_local_file_access function in url_validator.py to accommodate URLs with ports in host names.
Removed redundant entries in the local_prefixes list.

PR Quality Scorecard ✨

  • Have you used the PR description template?   +2 pts
  • Is your pull request atomic, focusing on a single change?   +5 pts
  • Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • Have you documented your changes clearly and comprehensively?   +5 pts
  • Have you changed or added a feature?   -4 pts
    • Have you added/updated corresponding documentation?   +4 pts
    • Have you added/updated corresponding integration tests?   +5 pts
  • Have you changed the behavior of AutoGPT?   -5 pts
    • Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

allow ports to be used in host names. e.g. localhost:8888. 
(Note: code generated by ChatGPT.)
@netlify
Copy link

netlify bot commented Sep 24, 2023

Deploy Preview for auto-gpt-docs ready!

Name Link
🔨 Latest commit d3ada38
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/654d4abd0aadc30008c9fadb
😎 Deploy Preview https://deploy-preview-5318--auto-gpt-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

# List of local hostnames/IPs without considering ports
local_domains = [
"localhost",
"2130706433", # IP representation of 127.0.0.1
Copy link
Member

Choose a reason for hiding this comment

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

TIL :)

"file:///",
"file://localhost/",
"file://localhost",
Copy link
Member

Choose a reason for hiding this comment

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

On what systems would this work?

@Pwuts Pwuts merged commit 8740006 into Significant-Gravitas:master Nov 16, 2023
6 of 8 checks passed
@Pwuts
Copy link
Member

Pwuts commented Nov 16, 2023

Also kudo's for indicating that the code was generated!

@aaron13100 aaron13100 deleted the patch-1 branch November 16, 2023 14:58
Pwuts added a commit that referenced this pull request Nov 23, 2023
- Modify the check_local_file_access function to only check for local file prefixes and return True if the URL starts with any of them.
- Remove the section of code that parsed the URL and checked if the hostname was in a list of local domains.

This change fixes the URL validation in the validators.py file. Previously, only local domains were allowed. After the change, non-local domains are allowed again.

(Note: this change was made in response to PR #5318 where the validation was modified to allow more local domains, but also accidentally to block any non-local domain.
aaron13100 added a commit to aaron13100/AutoGPT that referenced this pull request Nov 30, 2023
allow ports to be used in host names. e.g. localhost:8888. 
Note: code copied from pull request 5318, Significant-Gravitas#5318.
I did not test this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants