T09 · Insecure Skill Coding Practices
- Location
scripts/rwlib/endpoint.py:494- Finding
Repository-Controlled Endpoint Can Receive Document Excerpts Without Per-Endpoint Confirmation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/rwlib/endpoint.py:274-289andscripts/rwlib/endpoint.py:494-525
Vulnerability Type: Untrusted repository configuration controlling sensitive-data transmission
Risk Level: MediumVulnerable Code
python def _request(self, system, user, temperature, opener, thinking_off): payload = { "model": self.model, "messages": [{"role": "system", "content": system}, {"role": "user", "content": user}], "temperature": (self.temperature if temperature is None else float(temperature)), "max_tokens": self.max_output_tokens, "stream": False, } if thinking_off: payload.update(THINKING_OFF) body = json.dumps(payload).encode("utf-8") headers = {"Content-Type": "application/json"} if self.api_key: headers["Authorization"] = "Bearer %s" % self.api_key url = self.base_url + "/chat/completions" request = urllib.request.Request(url, data=body, headers=headers, method="POST") opener = opener or urllib.request.urlopenpython start_dirs = [] if target_path: start_dirs.append(os.path.dirname(os.path.abspath(target_path))) start_dirs.append(os.getcwd()) path = next((p for p in (_find_config(d) for d in start_dirs) if p), None) if path: try: with open(path, encoding="utf-8") as fh: config = json.load(fh) except (OSError, ValueError) as exc: return None, "%s could not be read: %s" % (path, exc) bad = problems(config, path) if bad: return None, " ".join(bad) env_name = config.pop("api_key_env", None) key = os.environ.get(env_name) if env_name else None if env_name and not key: return None, ("%s names api_key_env %r but that variable is not " "set in this envir ...[truncated 3334 chars]- Remediation
View remediation
Remediation Suggestions
- Do not automatically trust
.rabbit-modelfiles located inside the target Git working tree. - Require an interactive confirmation before the first transmission to a repository-selected endpoint. Display the normalized scheme, hostname, port, configuration source, and whether a credential will be attached.
- Provide a non-interactive option such as
--trust-model-endpoint HOST, requiring the caller to identify the expected host explicitly. - Prefer user-level configuration outside the audited repository, such as a file under the user's configuration directory.
- Allow administrators to define an endpoint allowlist and reject all other hosts.
- Do not send an API credential selected through repository configuration unless the endpoint has been independently trusted.
- Make
--model-planthe required first step for repository-local endpoint configurations so the user can review which excerpts would be transmitted. - Document clearly that
--apply-modelmay transmit portions of the target document to a third party.
- Do not automatically trust
