T09 · Insecure Skill Coding Practices
- Location
scripts/emit_cron_template.py:33- Finding
Shell Command Injection Through Unquoted Workspace Path in Generated Cron Template
- Content
View full analysis
= threshold", f"{daily_minute} */2 * * * cd {workspace} && python3 skills/better-memory/scripts/run_daily_review.py --workspace . --threshold-only", "", "# 2) Daily L1 -> L2 review (always run)", f"{daily_minute} {daily_hour} * * * cd {workspace} && python3 skills/better-memory/scripts/run_daily_review.py --workspace .", "", "# 3) Weekly L2 -> L3 rollup", f"{weekly_minute} {weekly_hour} * * {weekly_day} cd {workspace} && python3 skills/better-memory/scripts/run_weekly_rollup.py --workspace .", "", "# 4) Monthly advisory review report (no auto cleanup)", f"{monthly_minute} {monthly_hour} {settings['monthly_review_day']} * * cd {workspace} && python3 skills/better-memory/scripts/run_monthly_review.py --workspace .", "", ] ``` ### Technical Analysis The resolved workspace path is interpolated directly into shell command lines without shell quoting. Cron executes each command through a shell, so shell metacharacters in the workspace path can change the command's meaning. For example, a path containing characters such as `;`, `&&`, command substitution syntax, redirection operators, or whitespace can terminate or modify the intended `cd` command. Although this script only generates a template and does not install it automatically, the generated file is explicitly intended to be copied into a cron configuration. Scheduling values are also loaded from `.openclaw-memory-os/config.json` without revalidation inside `emit_cron_template()`. Bootstrap validates in ...[truncated 1399 chars]- Remediation
View remediation
