T09 · Insecure Skill Coding Practices
- Location
tools/feishu_bootstrap.py:43- Finding
Feishu Base token is exposed through command errors, local state, and terminal output
- Content
View full analysis
Dict[str, Any]: result = subprocess.run(cmd, capture_output=True, text=True) if result.returncode != 0: message = result.stderr.strip() or result.stdout.strip() raise RuntimeError(f"Command failed: {' '.join(cmd)}\n{message}") return json.loads(result.stdout) ``` ```python workspace_manifest.update( { "status": "ready", "created_at": datetime.now(timezone.utc).isoformat(), "base": { "base_token": base_info["base_token"], "name": base_info["name"], "url": base_info["url"], }, "tables": created_tables, "dashboards": [ {"name": item["name"], "dashboard_id": item["dashboard_id"]} for item in created_dashboards ], "capabilities": { "setup_complete": True, "artifact_generation": True, "remote_sync": True, }, } ) ensure_state_dir() WORKSPACE_MANIFEST_PATH.write_text( json.dumps(workspace_manifest, ensure_ascii=False, indent=2), encoding="utf-8" ) ``` ```python lines = ["# Feishu Bootstrap Result", ""] lines.append(f"- Status: `{result['status']}`") lines.append(f"- Base token: `{result['base']['base_token']}`") if result["base"].get("url"): lines.append(f"- Base URL: {result['base']['url']}") ``` ### Technical Analysis The bootstrap tool passes Feishu Base and folder tokens to `lark-cli` through a subprocess argument array. This avoids shell injection because `shell=True` is not used. However, token-bearing commands are reconstructed verbatim in exceptions, the Base token is saved in plaintext under `.headteacher-skill/w ...[truncated 1835 chars]- Remediation
View remediation
