T09 · Insecure Skill Coding Practices
- Location
scripts/design_llm.py:39- Finding
Provider-Confused API Credential Disclosure to Arbitrary Endpoints
- Content
View full analysis
Optional[str]: if not self._available: return None try: if self.provider == "openai" or self.base_url: from openai import OpenAI client_kwargs = {"api_key": self.api_key} if self.base_url: client_kwargs["base_url"] = self.base_url client = OpenAI(**client_kwargs) ``` ### Technical Analysis The implementation does not bind credentials to their intended providers. It selects the first available value from `OPENAI_API_KEY` and `ANTHROPIC_API_KEY`, regardless of the configured provider. Because the default provider is `openai`, an Anthropic credential can consequently be passed to the OpenAI client. The condition `self.provider == "openai" or self.base_url` also forces the OpenAI-compatible client path whenever any custom base URL is present. `DESIGN_LLM_BASE_URL` is accepted without HTTPS enforcement, hostname validation, or an allowlist. The selected API key is then provided to that endpoint as an authentication credential. This behavior can expose either provider's API key to an unintended or attacker-controlled server. A plaintext HTTP base URL would additionally ex ...[truncated 1614 chars]- Remediation
View remediation
