T09 · Insecure Skill Coding Practices
- Location
scripts/weather-full.sh:6- Finding
Shared credential file is evaluated as executable shell code
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
It provides weather forecasts, but it loads local secrets in a way that can run unintended shell code and expose API keys.
Review before installing. Use only if you are comfortable sending city/location and derived coordinates to WeatherAPI and Sunsethue, and consider changing the script to receive only WEATHERAPI_KEY and SUNSETHUE_KEY from a controlled environment instead of sourcing ~/.openclaw/.env.
scripts/weather-full.sh:6Shared credential file is evaluated as executable shell code
scripts/weather-full.sh:14API credentials are exposed in request URL query strings
The documented command directly sources ~/.openclaw/.env, causing all variables in that file to be loaded into the shell session before making a network request. Sourcing a broad secrets file is risky because it expands credential exposure scope and may execute unexpected shell content if the file is modified or unsafe.
source ~/.openclaw/.env && curl -s "https://api.weatherapi.com/v1/forecast.json?key=${WEATHERAPI_KEY}&q=Beijing&days=1&lang=zh&aqi=yes" | jq '{
location: .location.name,
temp: .current.temp_c,
condition: .current.condition.text,
This example again sources ~/.openclaw/.env before invoking an external API, exposing the session to all secrets in the file and trusting the file as shell code. In context, the skill is benign, but this pattern makes credential misuse and accidental disclosure more likely than necessary.
source ~/.openclaw/.env && curl -s "https://api.sunsethue.com/event?latitude=39.90&longitude=116.41&date=$(date +%Y-%m-%d)&type=sunset&key=${SUNSETHUE_KEY}" | jq '{
quality: (.data.quality * 100 | floor),
rating: .data.quality_text
}'
Reading credentials from a local .env file is common, but sourcing that file executes it as shell code rather than merely parsing key/value pairs. If the file is modified by another local process or attacker, arbitrary commands could run in the script's context, turning credential loading into code execution.
# 用法: weather-full.sh <城市> [天数]
# 加载环境变量
if [ -f ~/.openclaw/.env ]; then
source ~/.openclaw/.env
fi
The direct use of source on ~/.openclaw/.env means the file contents are treated as shell script. In an agent environment, this is riskier than standard environment access because a compromised or maliciously edited file could execute attacker-controlled commands when the skill runs.
# 加载环境变量
if [ -f ~/.openclaw/.env ]; then
source ~/.openclaw/.env
fi
CITY="${1:-Shanghai}"
The skill documents shell-based behavior and example command execution but does not declare any explicit tool scope or permissions. This weakens reviewability and increases the chance that an agent may invoke shell access without clear user-visible authorization boundaries.
The README instructs users to source a local .env file containing API keys and immediately send requests to third-party services, but it provides no warning that credentials are being loaded and used in outbound requests. This can lead to unintended credential exposure practices and poor operator awareness around secret handling.
This command transmits user-supplied location data and an API key to api.weatherapi.com. External transmission is expected for a weather skill, but it still creates privacy and secret-handling risk, especially because the key is embedded in the request URL and the transmission is not clearly disclosed near execution guidance.
source ~/.openclaw/.env && curl -s "https://api.weatherapi.com/v1/forecast.json?key=${WEATHERAPI_KEY}&q=Beijing&days=1&lang=zh&aqi=yes" | jq '{
location: .location.name,
temp: .current.temp_c,
condition: .current.condition.text,
This command sends coordinates, date, and an API key to api.sunsethue.com. That is functionally necessary for the feature, but it is still an outbound data flow to a third party and the secret is placed in the URL without prominent disclosure or minimization guidance.
source ~/.openclaw/.env && curl -s "https://api.sunsethue.com/event?latitude=39.90&longitude=116.41&date=$(date +%Y-%m-%d)&type=sunset&key=${SUNSETHUE_KEY}" | jq '{
quality: (.data.quality * 100 | floor),
rating: .data.quality_text
}'
The script loads local API keys from a user-specific .env file and sends user-supplied location data to third-party services without any consent prompt, privacy notice, or minimization. While expected for a weather skill, it still creates a real privacy boundary crossing and exposes precise location queries plus credentials-backed outbound requests to external providers.
This request transmits user-supplied location data and an API key to an external weather provider. In the context of an agent skill, undisclosed outbound transmission can expose sensitive user intent or location information and create dependency on a third-party service outside the local trust boundary.
DAYS="${2:-1}"
# 天气数据(WeatherAPI 支持中英文)
WEATHER_JSON=$(curl -s "https://api.weatherapi.com/v1/forecast.json?key=${WEATHERAPI_KEY}&q=${CITY}&days=${DAYS}&lang=zh&aqi=yes")
# 检查是否成功获取天气
if [ -z "$WEATHER_JSON" ] || echo "$WEATHER_JSON" | jq -e '.error' >/dev/null 2>&1; then
The WeatherAPI request hard-codes lang=zh, and all user-facing messages and usage text are in Chinese. This imposes a specific language on all users without opt-in or an explained region-specific justification, which matches the language/locale policy violation criteria.
This request sends derived latitude/longitude and date data to a second external service, expanding data sharing beyond the primary weather provider. Even though the data is used for legitimate functionality, precise coordinates can be more sensitive than a city name and increase privacy risk if users are not informed.
DATE=$(date +%Y-%m-%d)
# 朝霞
SUNRISE_JSON=$(curl -s "https://api.sunsethue.com/event?latitude=${LAT}&longitude=${LON}&date=${DATE}&type=sunrise&key=${SUNSETHUE_KEY}")
SUNRISE_QUALITY=$(echo "$SUNRISE_JSON" | jq -r '.data.quality * 100 | floor // 0')
SUNRISE_RATING=$(echo "$SUNRISE_JSON" | jq -r '.data.quality_text // "N/A"')
A second call to the same external service repeats the transmission of precise coordinates and date information for sunset calculations. Repeated third-party requests increase observability of user behavior and location-related metadata while relying on externally controlled infrastructure.
SUNRISE_RATING=$(echo "$SUNRISE_JSON" | jq -r '.data.quality_text // "N/A"')
# 晚霞
SUNSET_JSON=$(curl -s "https://api.sunsethue.com/event?latitude=${LAT}&longitude=${LON}&date=${DATE}&type=sunset&key=${SUNSETHUE_KEY}")
SUNSET_QUALITY=$(echo "$SUNSET_JSON" | jq -r '.data.quality * 100 | floor // 0')
SUNSET_RATING=$(echo "$SUNSET_JSON" | jq -r '.data.quality_text // "N/A"')