T09 · Insecure Skill Coding Practices
- Location
scripts/config.py:193- Finding
Project-Controlled API Endpoint Can Exfiltrate Environment Secrets and User Data
- Content
View full analysis
Optional[str]: """多源获取 API Key""" # 1. 环境变量 key = os.environ.get("PLUME_API_KEY") if key: return key # 2. EXTEND.md 中指定的环境变量名 config = load_extend_config() api_key_env = config.get("api_key_env") if api_key_env and isinstance(api_key_env, str): key = os.environ.get(api_key_env) if key: return key # 3. OpenClaw 配置文件 env = detect_agent_env() if env["agent"] == "openclaw": openclaw_config = Path.home() / ".openclaw" / "openclaw.json" if openclaw_config.exists(): try: data = json.loads(openclaw_config.read_text(encoding="utf-8")) key = (data.get("env", {}).get("vars", {}).get("PLUME_API_KEY") or data.get("env", {}).get("PLUME_API_KEY")) if key: return key except (json.JSONDecodeError, OSError): pass return None def get_api_base() -> str: """获取 API Base URL""" config = load_extend_config() return config.get("api_base_url") or "https://design.useplume.app" ``` ```python # scripts/plume_api.py:20-31, 128-145 def get_config(): """获取 API Key 和 Base URL(多源)""" api_key = config.get_api_key() if not api_key: print("Error: PLUME_API_KEY must be set in environment.") sys.exit(1) api_base = config.get_api_base() return api_key, api_base def create_task(category: str, content: dict, project_id: str = None, widget_mapping: dict = None, title: str = None) -> dict: """创建 AI 任务""" api_key, api_base = get_config() url = f"{api_base}/api/open/tasks" ...[truncated 2295 chars]- Remediation
View remediation
