T09 · Insecure Skill Coding Practices
- Location
scripts/backup.sh:24- Finding
Broad backup scope uploads sensitive OpenClaw data with incomplete sanitization
- Content
View full analysis
"$output" log_info "配置文件已脱敏" else log_error "配置文件不存在: $input" return 1 fi } do_backup() { cd "$OPENCLAW_DIR" log_info "开始备份 OpenClaw..." if [[ -z $(git status --porcelain 2>/dev/null) ]]; then log_info "没有变更需要备份" return 0 fi if [[ -f "openclaw.json" ]]; then cp openclaw.json openclaw.json.original sanitize_config "openclaw.json.original" "openclaw.json.staged" mv openclaw.json.staged openclaw.json fi git add -A local timestamp=$(date '+%Y-%m-%d %H:%M:%S') git commit -m "Auto backup: $timestamp" log_info "已提交备份: $timestamp" git push origin "$BACKUP_BRANCH" 2>/dev/null || { log_warn "推送失败,尝试强制推送..." git push origin "$BACKUP_BRANCH" --force } log_info "已推送到 GitHub" if [[ -f "openclaw.json.original" ]]; then mv openclaw.json.original openclaw.json log_info "已恢复原始配置" fi } ``` The installer uses the same unsafe pattern: ```bash if [[ -f "openclaw.json" ]]; then cp openclaw.json openclaw.json.original sed -E 's/"apiKey": "[^"]+"/"apiKey": "***SET_YOUR_API_KEY***"/g' openclaw.json.original > openclaw.json.staged mv openclaw.json.staged openclaw.json fi git add -A ``` ### Technical Analysis The scripts initialize `~/.openclaw` as a Git repository and execute `git add -A`, thereby staging every file not covered by the minimal `.gitignore`. According to `SKILL.md`, the intended backu ...[truncated 2248 chars]- Remediation
View remediation
