{"slug": "pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys", "title": "pip install 20 repos from a viral thread: what reads your exchange API keys?", "summary": "A developer's writeup warns that AI trading agents told to clone and install GitHub repos from a viral X thread can execute untrusted install-time code — setup.py, pyproject build backends, and npm preinstall/postinstall scripts — that reads exchange API keys from environment variables and .env files and can reach the network. The post offers grep commands to flag install hooks, key reads and outbound requests, but notes the checks miss obfuscated code, dependencies and prompt injection in READMEs, and recommends withdrawal-disabled, IP-bound keys and a first install in a container with no real credentials.", "body_md": "A post on X tells traders to hand their AI agent \"these 20 GitHub repos from best Hedge-funds & Quants\". If the agent clones one and runs `pip install .` or `npm install` inside it, that repo's own install code runs as your user before any strategy script starts. If it runs `pip install -r requirements.txt` instead, the code that runs belongs to every listed dependency that pip builds from source. That code can read your environment variables and the `.env` files that hold exchange API keys, and it can reach the network. The post's summary doesn't list the repos, so this covers risks you can check, not reported incidents.\n\nThe BTCUSDT 1h chart above (USDT, 2026-11-21 21:00 to 2026-11-28 20:00 UTC) is market background only.\n\nWhen installing from source, pip runs every top-level line of `setup.py`, not just custom `cmdclass` commands. A `pyproject.toml` project runs the build backend it names. npm runs the `preinstall`, `install`, `postinstall` and `prepare` scripts.\n\n```\nls setup.py 2>/dev/null  # if it exists, pip runs all of it: read the whole file\n# 1. install-time hooks\ngrep -nE '\"(pre|post)?(install|prepare)\"' package.json 2>/dev/null\ngrep -nE 'cmdclass|build-backend' setup.py pyproject.toml 2>/dev/null\n# 2. env and key reads\ngrep -rnE 'os\\.environ|getenv|load_dotenv|API_KEY|SECRET' --include='*.py' .\n# 3. outbound network\ngrep -rnE 'requests\\.(get|post)|urllib|httpx|https?://' --include='*.py' .\n```\n\nA hit only marks a line to read. Trading bots read keys and call exchanges for good reasons, so check where the key goes and which hosts the code contacts.\n\nAn empty result doesn't prove the repo is safe. pip still runs `setup.py`, and the greps only cover `.py` files, so they miss obfuscated code and every dependency pip or npm installs.\n\ngrep won't catch prompt injection. Skim the README and code comments for sentences written to an AI, such as a request to run a command or send a file. An agent may follow them.\n\nOn your exchange's API page, check each key: withdrawals off, trading on only if this use needs it, and bound to an IP. Use a separate read-only key for research. Do the first install in a container or a new user account with no real keys in its environment and no copy of your `.env`.\n\n*This article was written with AI assistance.*", "url": "https://wpnews.pro/news/pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys", "canonical_source": "https://dev.to/algorover1/pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys-5443", "published_at": "2026-11-29 16:09:46+00:00", "updated_at": "2026-11-29 16:15:55.430443+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "ai-tools"], "entities": ["GitHub", "X", "pip", "npm"], "also_reported_by": [], "takeaway": "Installing a repo with pip or npm runs its setup.py, build backend or npm install scripts as your user before any strategy code, so scan for install hooks, os.environ/getenv key reads and outbound requests, and do the first install in a container with no real API keys.", "recommendation": {"advice": "Before letting an agent install an unfamiliar repo, grep for install hooks, environment-variable reads and outbound requests, then run the first install in a container with no real exchange keys.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys", "markdown": "https://wpnews.pro/news/pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys.md", "text": "https://wpnews.pro/news/pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys.txt", "jsonld": "https://wpnews.pro/news/pip-install-20-repos-from-a-viral-thread-what-reads-your-exchange-api-keys.jsonld"}}