T09 · Insecure Skill Coding Practices
- Location
scripts/search.sh:7- Finding
Unvalidated Cursor Input Allows Bash Arithmetic Injection
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 fi if (( CURSOR > 1000 )); then echo "Error: cursor exceeds the permitted range" >&2 exit 1 fi START=$((10#$CURSOR * 10)) ``` Additional hardening measures: 1. Use `10#$CURSOR` to force decimal interpretation and avoid octal-related behavior for values with leading zeroes. 2. Apply a reasonable upper bound to prevent excessive API usage and integer edge cases. 3. Enable stricter shell behavior with `set -euo pipefail`, while handling expected command failures explicitly. 4. Consider implementing request construction in a language with strongly typed integer parsing if this script grows in complexity. ]]>
