T09 · Insecure Skill Coding Practices
Error
- Location
- oref_native.py:30
- Finding
- Unsafe hardcoded external messaging and Home Assistant destinations<![CDATA[ ## Vulnerability Details **File Location**: `oref_native.py:30-31`, `oref_native.py:43-44`, `oref_native.py:125-130`, and `oref_native.py:175-183` **Vulnerability Type**: Unsafe hardcoded external destinations and sensitive-data transmission **Risk Level**: High ### Vulnerable Code ```python HA_URL = os.getenv("HASS_SERVER", "https://ha.right-api.com") HA_TOKEN = os.getenv("HASS_TOKEN", "") HA_TTS_SPEAKER = os.getenv("HA_TTS_SPEAKER", "media_player.home_assistant_voice_09a069_media_player") ``` ```python WHATSAPP_GROUP = os.getenv("WHATSAPP_GROUP_JID", "120363417492964228@g.us") WHATSAPP_OWNER = os.getenv("WHATSAPP_OWNER", "+972525173322") ``` ```python def ha_tts(text: str): """הכרז קולית דרך רמקול Home Assistant""" try: r = requests.post( f"{HA_URL}/api/services/tts/google_translate_say", headers={"Authorization": f"Bearer {HA_TOKEN}", "Content-Type": "application/json"}, json={"entity_id": HA_TTS_SPEAKER, "message": text, "language": "iw"}, timeout=8 ) ``` ```python def dispatch(data: dict): current = data.get("current", {}) cat = str(current.get("cat", "1")) atype = ALERT_TYPES.get(cat, DEFAULT_TYPE) level = atype["level"] log.info(f"🚨 [{level}] Dispatching alert") wa_msg = build_message(data, atype) tts_text = atype["tts"] # 1️⃣ WhatsApp - קבוצת עדכונים בלבד if atype["whatsapp"]: openclaw_whatsapp(WHATSAPP_GROUP, wa_msg) # 3️⃣ רמקול HA - תמיד ha_tts(tts_text) ``` ### Technical Analysis The application uses a specific external Home Assistant domain, WhatsApp group JID, and personal telephone number as fallback values. The ownership or trustworthiness of these destinations cannot be established from the repository. When no explicit environment configuration is present, dispatched alerts are sent to the hardcoded WhatsApp group. Alert messages contain emergency type, timestamp, monitored ...[truncated 1767 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove all hardcoded personal telephone numbers, group JIDs, speaker identifiers, and external service domains. - Require `WHATSAPP_GROUP_JID` to be explicitly configured before enabling WhatsApp delivery. - Disable Home Assistant integration by default and invoke `ha_tts()` only when an explicit enable flag, URL, token, and speaker identifier are present. - Reject empty, malformed, or unexpected destinations at startup. - Consider an allowlist for Home Assistant hosts and require HTTPS for non-loopback destinations. - Display the configured recipients and endpoints and obtain explicit confirmation during installation. - Use a narrowly scoped Home Assistant token rather than an administrator token. - Remove the unused `WHATSAPP_OWNER` setting unless it is required by a documented feature. ]]>
