T09 · Insecure Skill Coding Practices
- Location
scripts/youtube.sh:18- Finding
Unsanitized YouTube Video ID Allows Filesystem Path Traversal
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 fi ``` 4. Construct the destination path only after validation and verify its canonical parent remains beneath the canonical workspace directory. 5. Reject identifiers containing `/`, `\`, `..`, control characters, or newline characters even if validation logic changes later. 6. Prevent symbolic-link attacks by ensuring the workspace has restrictive ownership and permissions, refusing symlinked path components, and using safely created files where practical. 7. Use `--` before positional path arguments for utilities that support it, for example: ```bash rm -f -- "$AUDIO_OUTPUT" "$TRANSCRIPT_OUTPUT" cat -- "$TRANSCRIPT_OUTPUT" ``` 8. Consider obtaining the canonical video ID from `yt-dlp` metadata and independently validating it before using it as a filename. ]]>
