T09 · Insecure Skill Coding Practices
- Location
scripts/01_intake_audit.sh:22- Finding
Intake Audit Destructively Modifies Documented Read-Only Source Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/01_intake_audit.sh, lines 22-26
Vulnerability Type: Destructive source-data mutation
Risk Level: Highbash # 1. Clean macOS noise echo "[1/4] Removing macOS noise files..." find "$SRC" -type f \( -name '._*' -o -name '.DS_Store' -o -name '*.dwl' -o -name '*.dwl2' \) -print > "$NOISE_LOG" | while read -r f; do rm -f "$f" doneTechnical Analysis
The intake workflow permanently deletes matched files from the supplied source directory. This conflicts with the source directory being described as read-only in
README.mdandSKILL.md.In addition to macOS metadata, the deletion pattern includes all
.dwland.dwl2files. These are AutoCAD lock and state files that can indicate drawings currently in use. The script performs no confirmation, backup, source/output boundary validation, or dry-run step before deletion.Because deletion occurs before inventory and hashing, the resulting manifest cannot prove exactly what the client originally supplied: deleted files never appear in the manifest.
Attack Path
- A client, attacker, or upstream process places a required file in the source tree with a matched name or
.dwl/.dwl2suffix. - An operator invokes the documented intake command against that directory.
findidentifies the file and passes its path torm -f.- The file is deleted under the invoking user's permissions without confirmation or backup.
- Inventory and hashing run only after deletion, omitting the removed artifact from the evidentiary record.
Impact Assessment
The script can delete every matched file reachable beneath
SRCfor which the invoking user has write permission. It does not obtain elevated privileges, but it can cause irreversible loss of client deliverables, interfere with active AutoCAD sessions, and undermine archive integrity and audit claims.- A client, attacker, or upstream process places a required file in the source tree with a matched name or
- Remediation
View remediation
Remediation Suggestions
- Treat the source tree as immutable and never invoke
rmagainst it. - Record unwanted files in the audit report without deleting them.
- If cleaning is required, first copy the source into a dedicated staging directory and remove files only from that copy.
- Add canonical-path validation to ensure source and output directories do not overlap.
- Require an explicit opt-in flag for destructive cleanup and provide a dry-run listing.
- Inventory and hash all original files before any optional cleanup.
- Use null-delimited traversal to handle unusual filenames safely.
- Treat the source tree as immutable and never invoke
