T09 · Insecure Skill Coding Practices
- Location
- features/voice_memory.py:17
- Finding
- Configurable API Endpoint Can Expose Bearer Credentials and Sensitive Voice Data<![CDATA[ ## Vulnerability Details **File Location**: `features/voice_memory.py:17-36` **Vulnerability Type**: Unvalidated destination for authenticated network requests **Risk Level**: High ### Vulnerable Code ```python API_KEY = os.getenv("BLUECOLUMN_API_KEY", "") BASE = os.getenv("BLUECOLUMN_BASE", "https://xkjkwqbfvkswwdmbtndo.supabase.co/functions/v1") def _headers(): return {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"} async def remember(text: str, title: str = None, tags: list = None, timeout: float = 10.0) -> Optional[str]: """Store a conversation/memory. Returns session_id. Feature 1 core.""" if not API_KEY or not text or len(text.strip()) < 5: return None payload = {"text": text[:8000]} if title: payload["title"] = title[:200] if tags: payload["tags"] = tags[:10] try: async with httpx.AsyncClient(timeout=timeout) as client: r = await client.post(f"{BASE}/agent-remember", headers=_headers(), json=payload) ``` The same configurable `BASE` and authorization header are also used by `recall()` and `note()` at lines 47-70. ### Technical Analysis `BLUECOLUMN_BASE` is read directly from the process environment and used as the destination of authenticated HTTP requests. The code does not validate that the URL: - Uses HTTPS. - Targets the documented BlueColumn Supabase host. - Has an approved path. - Cannot redirect authenticated requests to another destination. Every outbound request contains `BLUECOLUMN_API_KEY` in an `Authorization: Bearer` header. Depending on the operation, the request body can also contain voice transcripts, meeting transcripts, journal entries, CRM records, coaching information, sales records, customer identifiers, and recall queries. This issue is exploitable when an attacker can influence the process environment or deployment configuration. It does not independently grant an unauthenticated remote attacker control over the ...[truncated 1152 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Parse `BLUECOLUMN_BASE` with a standard URL parser before use. 2. Require the `https` scheme. 3. Allowlist the documented hostname, or maintain an explicit administrator-controlled list of trusted hosts. 4. Reject URLs containing user information, unexpected ports, fragments, or unapproved paths. 5. Disable redirects for authenticated requests, or verify every redirect destination before forwarding credentials. 6. Do not attach the authorization header to a request until its final destination has been validated. 7. If custom deployments must be supported, separate trusted endpoint registration from ordinary environment configuration and document the resulting trust boundary. 8. Use a narrowly scoped, revocable API credential and rotate it immediately if endpoint redirection is suspected. 9. Add tests that confirm HTTP URLs, unapproved hosts, and cross-host redirects are rejected. ]]>
