T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:5- Finding
Undisclosed Persistent Plaintext Logging of User-Supplied Content
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh, lines 5–7 and 35–83
Vulnerability Type: Persistent plaintext storage of potentially sensitive user input
Risk Level: MediumVulnerable Code
bash DATA_DIR="${SHORT_DRAMA_WRITER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/short-drama-writer}" DB="$DATA_DIR/data.log" mkdir -p "$DATA_DIR"bash _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }User-controlled command arguments are passed to this logging function by the content commands:
bash cmd_draft() { echo " Draft: $1 Target: ${2:-800} words" _log "draft" "${1:-}" } cmd_headline() { echo " 1. How to $1 2. $1: Complete Guide 3. Why $1 Matters" _log "headline" "${1:-}" } cmd_outline() { echo " 1. Intro | 2. Problem | 3. Solution | 4. Examples | 5. CTA" _log "outline" "${1:-}" } cmd_seo() { echo " Keywords: $1 | Title tag | Meta desc | H1-H3 | Internal links" _log "seo" "${1:-}" } cmd_schedule() { echo " Mon: Research | Tue: Write | Wed: Edit | Thu: Publish | Fri: Promote" _log "schedule" "${1:-}" } cmd_hooks() { echo " Question | Statistic | Story | Bold claim | Controversy" _log "hooks" "${1:-}" } cmd_cta() { echo " Subscribe | Share | Comment | Try it | Learn more" _log "cta" "${1:-}" } cmd_repurpose() { echo " Blog -> Thread -> Video -> Carousel -> Newsletter" _log "repurpose" "${1:-}" } cmd_metrics() { echo " Views | Clicks | Shares | Time on page | Conversions" _log "metrics" "${1:-}" } cmd_ideas() { echo " How-to | Listicle | Case study | Interview | Comparison" _log "ideas" "${1:-}" }Technical Analysis
The script automatically creates a persistent data directory and appends raw command arguments to
history.log. Users may reasonably supply con ...[truncated 1984 chars]- Remediation
View remediation
Remediation Suggestions
- Disable input logging by default and only enable it through explicit user consent.
- Do not store raw command arguments. If telemetry is required, record only non-sensitive event metadata, such as the command name and execution time.
- Clearly document what is stored, where it is stored, why it is needed, and how long it is retained.
- Establish restrictive permissions before creating storage:
bash umask 077 mkdir -p -- "$DATA_DIR" chmod 700 -- "$DATA_DIR" - Create the history file with user-only permissions:
bash touch -- "$DATA_DIR/history.log" chmod 600 -- "$DATA_DIR/history.log" - Add configurable retention limits and a command that securely clears stored history.
- If logging must remain available, provide a redaction mechanism and avoid recording free-form content.
- Remove the unused
DBvariable if no database file is required, reducing ambiguity about the tool's storage behavior.
