T05 · Unauthorized Access and Privilege Escalation
- Location
references/cross_funding.py:192- Finding
Overbroad Access to OpenClaw and ZeroClaw Credential Stores
- Content
View full analysis
list[dict]: """Read all available daemon configs for bot token resolution. Returns a list of config sources (OpenClaw JSON + ZeroClaw TOML instances). Callers try each source in order until a token is found. """ sources: list[dict] = [] # OpenClaw: JSON format oc_path = Path.home() / ".openclaw" / "openclaw.json" if oc_path.exists(): try: data = json.loads(oc_path.read_text()) channels = data.get("channels", {}) sources.append({"_type": "openclaw", "_data": channels}) except Exception: pass # ZeroClaw: TOML format (try all instances) for instance in ["zeroclaw-strategy", "zeroclaw", "zeroclaw-data", "zeroclaw-ops"]: cfg_path = Path.home() / f".{instance}" / "config.toml" if cfg_path.exists(): try: sources.append({"_type": "zeroclaw", "_text": cfg_path.read_text()}) except Exception: pass return sources _DAEMON_CONFIGS = _read_daemon_configs() def _get_discord_token() -> str: """Discord bot token: env > first available daemon config.""" env_token = os.environ.get("DISCORD_BOT_TOKEN", "") if env_token: return env_token for cfg in _DAEMON_CONFIGS: token = "" if cfg["_type"] == "openclaw": token = cfg.get("_data", {}).get("discord", {}).get("token", "") elif cfg["_type"] == "zeroclaw": section = _parse_toml_section( cfg.get("_text", ""), "channels_config.discord" ) token = section.get("bot_token", "") if token: return token return "" def _get_telegram_config() -> tuple[str, str]: """Telegram creds: ...[truncated 3191 chars]- Remediation
View remediation
