T09 · Insecure Skill Coding Practices
- Location
extract_session.py:143- Finding
Unredacted session and tool data is transmitted to an external AI service
- Content
View full analysis
str: """Call MiniMax API for extraction.""" api_key = load_minimax_api_key() if not api_key: raise RuntimeError("MiniMax API key not found in auth-profiles.json") import urllib.request import urllib.error model_name = model.split("/")[-1] if "/" in model else model url = "https://api.minimaxi.com/v1/text/chatcompletion_v2" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", } # v1.0.6: bumped from 8000 to 32000 to handle trajectory transcripts (which can be 25K+ chars for long sessions) truncated = content[:32000] if len(content) > 32000 else content payload = { "model": model_name, "messages": [ {"role": "system", "content": EXTRACTION_PROMPT}, {"role": "user", "content": f"Session transcript:\n{truncated}"}, ], "max_tokens": 1024, "temperature": 0.3, } req = urllib.request.Request( url, data=json.dumps(payload).encode(), headers=headers, method="POST" ) try: with urllib.request.urlopen(req, timeout=60) as resp: result = json.load(resp) ``` Trajectory processing also incorporates internal reasoning, tool arguments, and tool results: ```python elif btype == 'thinking': text = block.get('thinking', '').strip() if text: lines.append(f"[THINKING] {text[:500]}") elif btype == 'toolCall': name = block.get('name', block.get('toolName', '?')) args = block.get('arguments', block.get('input', {})) args_str = json.dumps(args, ensure_ascii=False)[:300] if args else '' lines.append(f"[TOOL_CALL] {name}( ...[truncated 2296 chars]- Remediation
View remediation
