T09 · Insecure Skill Coding Practices
- Location
click.sh:115- Finding
Command Injection Through Unvalidated Arithmetic Expressions
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 fi ``` Perform validation before both direct `xdotool` use and window-relative arithmetic. Validate values obtained from `xdotool` as well: ```bash if ! [[ "$WIN_X" =~ ^-?[0-9]+$ ]] || ! [[ "$WIN_Y" =~ ^-?[0-9]+$ ]]; then echo "ERROR: invalid window geometry" >&2 exit 1 fi ``` Additional hardening should include: 1. Enforce sensible upper and lower coordinate bounds. 2. Apply strict integer validation to `--amount`, `--delay`, `--width`, `--height`, and other numeric parameters in the remaining scripts. 3. Avoid evaluating untrusted strings as arithmetic expressions. 4. Add regression tests using arithmetic metacharacters, command substitutions, array syntax, whitespace, signs, and oversized values. ]]>
