T09 · Insecure Skill Coding Practices
- Location
scripts/common.py:85- Finding
Bearer Credentials and Uploaded Documents May Be Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/common.py:85-91,scripts/common.py:174-183, andscripts/upload.py:122-130
Vulnerability Type: Plaintext transmission of sensitive information
Risk Level: HighVulnerable Code
scripts/common.py:85-91permits any absolute URL with a scheme and network location, including plaintext HTTP:python def resolve_base_url(cli_base_url: str | None = None) -> str: base_url = (cli_base_url or "").strip() or _require_env_var(RAGFLOW_API_URL_ENV) parsed = urllib.parse.urlsplit(base_url) if not parsed.scheme or not parsed.netloc: raise ConfigError( f"Invalid {RAGFLOW_API_URL_ENV}. Use an absolute URL such as http://127.0.0.1:9380." ) return base_url.rstrip("/")scripts/common.py:174-183sends the API key as a bearer credential to the accepted URL:python headers = {"Authorization": f"Bearer {api_key}"} if accept: headers["Accept"] = accept if content_type: headers["Content-Type"] = content_type request_obj = urllib.request.Request(url, headers=headers, data=body, method=method) try: with urllib.request.urlopen(request_obj, timeout=HTTP_TIMEOUT) as response: return decode_json_response(response.read())scripts/upload.py:122-130sends both the bearer credential and the complete multipart document body over the configured transport:python boundary, body = _build_multipart(file_paths) url = f"{base_url}/api/v1/datasets/{dataset_id}/documents" request_obj = urllib.request.Request(url, data=body, method="POST") request_obj.add_header("Authorization", f"Bearer {api_key}") request_obj.add_header("Content-Type", f"multipart/form-data; boundary={boundary}") try: with urllib.request.urlopen(request_obj, timeout=120) as response: payload = decode_json_response(response.read())Technical Analysis
The shared URL validation checks only that a scheme and network location exist. It does not require HTTPS, ...[truncated 2833 chars]
- Remediation
View remediation
Remediation Suggestions
-
Require HTTPS by default
- Accept only
httpsfor non-loopback endpoints. - Reject unknown schemes explicitly.
- Do not silently downgrade or redirect sensitive requests from HTTPS to HTTP.
- Accept only
-
Restrict development-time HTTP use
- Permit HTTP only for verified loopback hosts such as
127.0.0.1,::1, orlocalhost. - Require an explicit, clearly named opt-in flag for any broader plaintext use.
- Emit a prominent security warning when plaintext transport is enabled.
- Permit HTTP only for verified loopback hosts such as
-
Correct configuration guidance
- Replace the current HTTP example with an HTTPS example.
- Document that the API key and uploaded files are transmitted to
RAGFLOW_API_URL. - Explain the security implications of using HTTP.
-
Harden TLS behavior
- Retain standard certificate and hostname verification.
- Support a configured private CA bundle for self-hosted deployments rather than recommending disabled verification.
- Consider certificate pinning in environments with strict endpoint trust requirements.
-
Limit credential impact
- Use a dedicated, least-privilege RAGFlow API key for this Skill.
- Separate read-only and mutation credentials where RAGFlow supports that model.
- Rotate any key that may previously have been used over untrusted HTTP.
-
Add regression tests
- Verify that remote
http://URLs are rejected. - Verify that loopback HTTP is accepted only under the documented exception policy.
- Verify that redirects cannot move authorization headers or uploaded bodies to an untrusted or plaintext destination.
- Verify that remote
-
