T09 · Insecure Skill Coding Practices
- Location
scripts/read_thread.sh:19- Finding
Command Injection Through Unvalidated Thread Depth Argument
- Content
View full analysis
- Remediation
View remediation
50 )); then echo '{"error":"max_depth must be a decimal integer from 1 to 50"}' | jq . exit 1 fi ``` The `10#` prefix forces base-10 interpretation after the regular-expression check, avoiding unexpected octal handling for values with leading zeroes. Additional hardening measures: 1. Keep a fixed upper bound to prevent excessive network requests and resource consumption. 2. Do not pass natural-language or otherwise untrusted values directly as the second argument. 3. Add regression tests that reject letters, signs, whitespace, shell metacharacters, arithmetic expressions, array syntax, and command-substitution syntax. 4. Run the Skill under a minimally privileged account with limited filesystem and credential access. 5. Consider removing the configurable depth argument entirely if a fixed limit is sufficient for the declared functionality. ]]>
