Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Restrict browse from accessing local files

onekumfa8461be9de4
diff --git a/scripts/browse.py b/scripts/browse.py
index c15214e7dd..4a73d92320 100644
--- a/scripts/browse.py
+++ b/scripts/browse.py
@@ -11,6 +11,10 @@ def scrape_text(url):
if not url.startswith('http'):
return "Error: Invalid URL"
+ # Restrict access to local files
+ if url.startswith('file://') or url.startswith('file://localhost'):
+ return "Error: Access to local files is restricted"
+
try:
response = requests.get(url, headers=cfg.user_agent_header)
except requests.exceptions.RequestException as e:
@@ -126,4 +130,4 @@ def summarize_text(text, question):
max_tokens=300,
)
- return final_summary
\ No newline at end of file
+ return final_summary