T09 · Insecure Skill Coding Practices
- Location
scripts/v2/url_extractor.py:274- Finding
MiniMax API Key May Be Disclosed to OpenAI
- Content
View full analysis
ExtractedContent: """Call an LLM to generate a summary and key points.""" if not api_key: api_key = os.environ.get("MINIMAX_API_KEY") or os.environ.get("OPENAI_API_KEY", "") if not api_key or not content.full_text: return content try: import openai except ImportError: try: import sys subprocess.run([sys.executable, "-m", "pip", "install", "openai", "-q"], check=True) import openai except Exception: return content text_input = content.full_text[:3000] try: client = openai.OpenAI( api_key=api_key, base_url="https://api.openai.com/v1" if "sk-" in api_key else "https://api.minimax.io/v1" ) ``` ### Technical Analysis The function selects `MINIMAX_API_KEY` before `OPENAI_API_KEY`, but chooses the destination provider by checking whether the selected credential contains the generic substring `sk-`. The Skill documentation states that MiniMax credentials can begin with `sk-cp-`. Such a key satisfies the condition `"sk-" in api_key`, causing the code to configure `https://api.openai.com/v1` as the API endpoint. The MiniMax credential is then transmitted to an unrelated third-party provider as an authorization credential. Provider routing based on a partial credential prefix is not a safe trust-boundary decision. Credentials must be explicitly associated with their intended provider and endpoint. ### Attack Path 1. A user configures only `MINIMAX_API_KEY`, using a documented MiniMax key beginning with `sk-cp-`. 2. The user invokes URL extraction with the summarization option. 3. `generate_summary()` selects `MIN ...[truncated 791 chars]- Remediation
View remediation
