T09 · Insecure Skill Coding Practices
- Location
nest-sdm.sh:77- Finding
Python Source Injection Through CLI Arguments
- Content
View full analysis
[name_filter] # name_filter matches against customName or room displayName (case-insensitive, substring) get_device_id() { local dtype="$1" local name_filter="${2:-}" api_get "devices" | python3 -c " import sys, json devices = json.load(sys.stdin).get('devices', []) name_filter = '''${name_filter}'''.strip().lower() matches = [] for d in devices: if d['type'] == 'sdm.devices.types.${dtype}': matches.append(d) if not matches: print(f'Error: No ${dtype} device found.', file=sys.stderr) sys.exit(1) if name_filter: filtered = [] for d in matches: custom = d.get('traits', {}).get('sdm.devices.traits.Info', {}).get('customName', '').lower() room = (d.get('parentRelations', [{}])[0].get('displayName', '') or '').lower() if name_filter in custom or name_filter in room: filtered.append(d) if not filtered: avail = [] for d in matches: custom = d.get('traits', {}).get('sdm.devices.traits.Info', {}).get('customName', '') room = d.get('parentRelations', [{}])[0].get('displayName', '') label = custom or room or '(unnamed)' avail.append(label) print(f'Error: No ${dtype} matching \"{name_filter}\". Available: {\", \".join(avail)}', file=sys.stderr) sys.exit(1) matches = filtered print(matches[0]['name'].split('/')[-1]) " } ``` A related instance occurs at line 414: ```bash echo "✅ Fan ON for ${duration}s ($(python3 -c "print(${duration} ...[truncated 2127 chars]- Remediation
View remediation
