T09 · Insecure Skill Coding Practices
- Location
scripts/save-report.sh:35- Finding
Existing Reports Are Overwritten Without Explicit Authorization
- Content
View full analysis
&2 fi # Read content from file argument or stdin if [[ $# -ge 2 ]]; then INPUT_FILE="$2" if [[ ! -f "$INPUT_FILE" ]]; then echo "Error: input file '$INPUT_FILE' not found." >&2 exit 1 fi cp "$INPUT_FILE" "$OUTPUT_FILE" else # Read from stdin cat > "$OUTPUT_FILE" fi ``` ### Technical Analysis The output filename is constructed exclusively from the current date and a normalized, user-supplied slug. Consequently, all reports generated with the same normalized slug on the same day resolve to an identical path. The collision check only emits a warning. It does not request confirmation, reject the operation, preserve the existing report, or require an explicit overwrite option. Both `cp "$INPUT_FILE" "$OUTPUT_FILE"` and `cat > "$OUTPUT_FILE"` replace the contents of an existing destination. Different inputs may also normalize to the same slug. For example, case differences, spaces, and stripped punctuation can produce an identical normalized value. The implementation therefore permits accidental or intentional replacement of a previously generated report. This behavior also conflicts with the statement in `SKILL.md` that the script “creates files” and “never modifies” existing workspace content. ### Attack Path 1. A report is saved with a slug such as `market-analysis`. 2. The script creates a path such as `workspace/research/competitive-intel/2026-09-12-market-analysis.md`. 3. On the same day, another invocation supplies the same slug or a different input that normalizes to the same value. 4. The script detects the existing file ...[truncated 969 chars]- Remediation
View remediation
