T09 · Insecure Skill Coding Practices
- Location
searxng_search.py:55- Finding
Search Queries Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
str: """Get and validate SEARXNG_URL from environment.""" url = os.environ.get("SEARXNG_URL", "").strip() if not url: return "" # Normalize: remove trailing slash, ensure no /search suffix for base url = url.rstrip("/") if url.endswith("/search"): url = url[:-7] return url ``` ### Technical Analysis The Skill must transmit a user-provided query to a SearXNG instance to perform its declared web-search function. That network access is functionally necessary and does not, by itself, exceed minimum privilege. However, the implementation accepts arbitrary URL schemes, and the documentation recommends an `http://` configuration. The search query is included in the request URL through the `q` query-string parameter. When HTTP is used, neither the query nor the returned search results receive transport confidentiality or integrity protection. A network observer, compromised proxy, or other on-path attacker could inspect sensitive search terms or modify the response in transit. URL-based que ...[truncated 1493 chars]- Remediation
View remediation
str: url = os.environ.get("SEARXNG_URL", "").strip().rstrip("/") if not url: return "" parsed = urlparse(url) loopback_hosts = {"localhost", "127.0.0.1", "::1"} if parsed.scheme != "https": if parsed.scheme != "http" or parsed.hostname not in loopback_hosts: raise ValueError( "SEARXNG_URL must use HTTPS; HTTP is allowed only for loopback endpoints" ) if url.endswith("/search"): url = url[:-7] return url ``` ]]>
