T09 · Insecure Skill Coding Practices
- Location
scripts/list-speakers.sh:17- Finding
Arbitrary Python Code Injection Through the Language Argument
- Content
View full analysis
- Remediation
View remediation
&2 exit 2 ;; esac printf '%s' "$RESP" | python3 -c ' import json import sys data = json.load(sys.stdin) lang_filter = sys.argv[1] for item in data["data"]["items"]: if lang_filter and item["language"] != lang_filter: continue print( f"{item['"'"'speakerId'"'"']:40s} " f"{item['"'"'name'"'"']:10s} " f"{item['"'"'gender'"'"']:6s} " f"{item['"'"'language'"'"']}" ) ' "$LANGUAGE" ``` Additional hardening measures: 1. Treat every command-line argument as untrusted, including values selected or generated by an Agent. 2. Prefer a standalone Python file over dynamically constructed source code for nontrivial parsing. 3. Use an explicit allowlist for accepted language identifiers. 4. Run the Skill under a dedicated least-privileged account with access only to required credentials and files. 5. Avoid inheriting unrelated secrets in the Skill process environment. 6. Add regression tests containing quotes, semicolons, newlines, backslashes, and Python expressions to verify that arguments remain data rather than executable code. ]]>
