T08 · Insecure Dependencies
Error
- Location
- fastloop_improved.py:169
- Finding
- Unpinned Third-Party Dependency Receives the Wallet Private Key<![CDATA[ ## Vulnerability Details **File Location**: `fastloop_improved.py:169-190`; dependency declarations in `SKILL.md:12-15` and `clawhub.json:2-9` **Vulnerability Type**: Supply-chain exposure of a high-value secret **Risk Level**: High ### Vulnerable Code ```python def get_client(live=True, discovery=False): global _client, _discovery_client # New V8.9.3: Discovery Client always uses real-market venue to avoid scanning "empty" sim servers if discovery: if _discovery_client is None: from simmer_sdk import SimmerClient api_key = os.environ.get("SIMMER_API_KEY") if not api_key: print("Error: SIMMER_API_KEY for discovery not set"); sys.exit(1) # Discovery doesn't need a wallet or live-signing _discovery_client = SimmerClient(api_key=api_key, venue="polymarket", live=True) return _discovery_client if _client is None: from simmer_sdk import SimmerClient api_key = os.environ.get("SIMMER_API_KEY") if not api_key: print("Error: SIMMER_API_KEY not set"); sys.exit(1) priv_key = os.environ.get("WALLET_PRIVATE_KEY") venue = "polymarket" if priv_key else "sim" if priv_key: print(f"🔐 Wallet Private Key detected. Mode: {venue.upper()} (LIVE: {live})") else: print(f"🍦 No Wallet Private Key. Mode: SIMULATION (Dry Run: {live})") _client = SimmerClient(api_key=api_key, venue=venue, live=live, private_key=priv_key) ``` The dependency is declared without a version or integrity constraint: ```yaml pip: - simmer-sdk ``` ```json { "requires": { "pip": [ "simmer-sdk" ], "env": [ "SIMMER_API_KEY", "WALLET_PRIVATE_KEY" ] } } ``` ### Technical Analysis The Skill reads `WALLET_PRIVATE_KEY` from the environment and passes the raw value directly into `SimmerClient`, which is imported from the externally installed `simmer-sdk` package. Th ...[truncated 1776 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `simmer-sdk` to an exact, reviewed version rather than allowing unconstrained upgrades. 2. Require package integrity hashes, such as with a hash-locked requirements file. 3. Audit the SDK code paths that accept `api_key` and `private_key`, including all network operations. 4. Prefer an isolated signing component or hardware wallet that exposes only a narrowly scoped signing interface rather than the raw private key. 5. Run discovery without loading `WALLET_PRIVATE_KEY`; load signing capability only immediately before an explicitly authorized live trade. 6. Restrict outbound network access for the signing process to documented and approved endpoints. 7. Monitor dependency ownership and release changes and require review before version upgrades. 8. Use a dedicated low-balance trading wallet with narrowly scoped approvals to limit losses if the signing boundary is compromised. ]]>
