T09 · Insecure Skill Coding Practices
- Location
scripts/tavily_proxy_search.py:39- Finding
Bearer credential may be transmitted over unencrypted HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/tavily_proxy_search.py:39-67
Vulnerability Type: Plaintext transmission of sensitive credentials
Risk Level: MediumVulnerable Code
python def tavily_proxy_search(query: str, max_results: int, include_answer: bool, search_depth: str): proxy_url = load_proxy_url() master_key = load_master_key() if not master_key: raise SystemExit( "Missing TAVILY_PROXY_MASTER_KEY. Set env var TAVILY_PROXY_MASTER_KEY or add it to ~/.openclaw/.env" ) payload = { "query": query, "max_results": max_results, "search_depth": search_depth, "include_answer": bool(include_answer), "include_images": False, "include_raw_content": False, } data = json.dumps(payload).encode("utf-8") req = urllib.request.Request( proxy_url, data=data, headers={ "Content-Type": "application/json", "Accept": "application/json", "Authorization": f"Bearer {master_key}", }, method="POST", )The default endpoint is also explicitly configured with an unencrypted scheme at
scripts/tavily_proxy_search.py:10:python DEFAULT_TAVILY_PROXY_URL = "http://127.0.0.1:8080/search"Technical Analysis
The script places
TAVILY_PROXY_MASTER_KEYin the HTTPAuthorizationheader and submits it to the user-configurableTAVILY_PROXY_URL. It does not validate the endpoint scheme or restrict unencrypted HTTP to loopback addresses.The default loopback endpoint substantially limits exposure because traffic normally remains on the local host. However, the documented configuration permits replacing that endpoint, and the implementation will accept a remote
http://URL without warning. When such a URL is used, both the bearer credential and search queries travel without transport enc ...[truncated 2435 chars]- Remediation
View remediation
Remediation Suggestions
- Parse
TAVILY_PROXY_URLwithurllib.parse.urlparsebefore constructing the request. - Require the
httpsscheme for every non-loopback endpoint. - Permit plaintext HTTP only when the resolved destination is a loopback address such as
127.0.0.1or::1. - If remote HTTP must be supported for exceptional development environments, require an explicit option such as
--allow-insecure-httpand emit a prominent warning. Keep this override disabled by default. - Continue using Python's default TLS certificate and hostname verification. Do not introduce an unverified SSL context.
- Document that production deployments must use HTTPS with a valid certificate and that a reverse proxy should terminate TLS if TavilyProxyManager does not do so directly.
- Rotate the master key immediately if it may previously have been transmitted over an untrusted plaintext connection.
- Apply least privilege to the proxy key where supported, restrict endpoint access through firewall rules, and monitor for unexpected key usage.
- Consider rejecting URLs containing embedded user information and validating that the configured path is the expected
/searchendpoint.
- Parse
