File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/datapilot/core/knowledge Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,16 @@ def do_GET(self):
5151 def handle_knowledge_base (self , public_id ):
5252 """Fetch and return knowledge base data."""
5353 url = f"{ backend_url } /knowledge_bases/public/{ public_id } "
54+
55+ # Validate URL scheme for security
56+ parsed_url = urlparse (url )
57+ if parsed_url .scheme not in ('http' , 'https' ):
58+ self .send_response (400 )
59+ self .send_header ("Content-Type" , "application/json" )
60+ self .end_headers ()
61+ error_msg = json .dumps ({"error" : "Invalid URL scheme. Only HTTP and HTTPS are allowed." })
62+ self .wfile .write (error_msg .encode ("utf-8" ))
63+ return
5464
5565 headers = {"Authorization" : f"Bearer { token } " , "X-Tenant" : instance_name , "Content-Type" : "application/json" }
5666
You can’t perform that action at this time.
0 commit comments