T09 · Insecure Skill Coding Practices
- Location
scripts/langcache.sh:118- Finding
Configurable LangCache Host Can Receive API Credentials and User Content
- Content
View full analysis
&2 echo "Set them in ~/.openclaw/secrets.env or export them directly." >&2 exit 1 fi } base_url() { echo "https://${LANGCACHE_HOST}/v1/caches/${LANGCACHE_CACHE_ID}" } api_request() { local method="$1" local endpoint="$2" local data="${3:-}" local url url="$(base_url)${endpoint}" local args=( -s -X "$method" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer ${LANGCACHE_API_KEY}" ) if [[ -n "$data" ]]; then args+=(-d "$data") fi curl "${args[@]}" "$url" } ``` The Python example contains equivalent behavior at `examples/agent-integration.py:134-139`: ```python self.cache = LangCache( server_url=f"https://{os.environ['LANGCACHE_HOST']}", cache_id=os.environ["LANGCACHE_CACHE_ID"], api_key=os.environ["LANGCACHE_API_KEY"], ) ``` ### Technical Analysis The code validates only that `LANGCACHE_HOST` is nonempty. It does not verify that the destination belongs to Redis LangCache or another explicitly trusted service. The API key is subsequently placed in the Authorization header of every request to that configurable host. Remote semantic caching requires network access, so sending prompts and responses to a cache service is consistent with the declared function. However, sending a credential to any environment-selected host ...[truncated 1432 chars]- Remediation
View remediation
