T09 · Insecure Skill Coding Practices
Error
- Location
scripts/setup.sh:37- Finding
Arbitrary Shell Command Execution Through Unsafely Generated Configuration
- Content
View full analysis
"$CONFIG_FILE" <- Remediation
View remediation
"$CONFIG_FILE" ``` 2. Reject control characters, particularly carriage returns and newlines, before writing values: ```bash if [[ "$ACORN_LIB" == *$'\n'* || "$ACORN_LIB" == *$'\r'* || "$ACORN_PROJECT" == *$'\n'* || "$ACORN_PROJECT" == *$'\r'* ]]; then echo "Error: Paths must not contain newline characters." >&2 exit 1 fi ``` 3. Canonicalize and revalidate both paths with an appropriate mechanism such as `realpath`, while preserving strict quoting. 4. Write the configuration atomically with restrictive permissions, such as mode `0600`, to reduce local tampering risks. 5. Do not use `source` for attacker-influenced files. If possible, read expected keys as data and reject unknown or duplicate entries. 6. Add regression tests covering spaces, quotes, semicolons, command substitutions, backslashes, and newline characters in path arguments. ]]>
