T09 · Insecure Skill Coding Practices
- Location
scripts/create.sh:69- Finding
Arbitrary Python Code Execution Through Unsafe Variable Interpolation
- Content
View full analysis
/dev/null || python3 -c " from datetime import datetime print(int(datetime.strptime('$START_TIME', '%Y-%m-%d %H:%M').timestamp())) ") ``` #### Meeting topic and recurrence-rule interpolation at lines 82–95 ```bash EVENT_JSON=$(python3 -c " import json event = { 'summary': '''$MEETING_TOPIC''', 'start_time': {'timestamp': '$START_TS', 'timezone': 'Asia/Shanghai'}, 'end_time': {'timestamp': '$END_TS', 'timezone': 'Asia/Shanghai'}, 'vchat': {'vc_type': 'vc'}, 'attendee_ability': 'can_see_others' } rrule = '''$RRULE''' if rrule: r = rrule.replace('RRULE:', '') if 'COUNT' not in r and 'UNTIL' not in r: r += ';COUNT=52' event['recurrence'] = r print(json.dumps(event, ensure_ascii=False)) ") ``` #### Owner and resolved identifier interpolation at lines 146–151 ```bash ATTENDEES_JSON=$(python3 -c " import json owner = '$DEFAULT_OWNER_OPEN_ID' extras = [x for x in '$EXTRA_OPEN_IDS'.split(',') if x] all_ids = list(dict.fromkeys([owner] + extras)) print(json.dumps({'attendees': [{'type':'user','user_id':uid} for uid in all_ids]})) ") ``` ### Technical Analysis The script constructs Python programs using `python3 -c` and directly inserts shell-variable contents into the Python source. These values are not encoded as Python string literals and are not passed through a structured interface such as command-line arguments or standard input. The following values reach generated Python source: - `START_TIME`, supplied through `--start` - `MEETING_TOPIC`, supplied as the first positional argument - `RRULE`, supplied through `--rrule` - `DEFAULT_OWNER_OPEN_ID`, obtained from configuration - `EXTRA_OPEN_IDS`, derived from the Feishu API res ...[truncated 2486 chars]- Remediation
View remediation
