T09 · Insecure Skill Coding Practices
- Location
scripts/developer-self-improve-core.sh:340- Finding
Proposal Cleanup Ignores the Configured Safety Control
- Content
View full analysis
/dev/null | cut -d: -f2 | tr -d ' ' || echo "7") local current_time=$(date +%s) local expired_count=0 echo "📅 检查超期提案(保留${retention_days}天)..." for file in "$PROPOSALS_DIR"/*.md; do if [ -f "$file" ]; then local file_time=$(stat -c %Y "$file" 2>/dev/null || echo "0") local age_days=$(( (current_time - file_time) / 86400 )) if [ "$age_days" -gt "$retention_days" ]; then echo " ⚠️ 超期文件:$(basename $file)(已${age_days}天)" rm -f "$file" expired_count=$((expired_count + 1)) fi fi done if [ "$expired_count" -gt 0 ]; then echo "✅ 已清理 $expired_count 个超期文件" echo "$(date -Iseconds) CLEANUP_EXPIRED count=$expired_count" >> "$LOGS_DIR/operations.log" else echo "✓ 无超期提案" fi } # 4. 定期清洗 cleanup() { echo "🧹 执行记忆清洗扫描..." cleanup_expired_proposals ``` The corresponding safety setting is declared in `config/config.yaml`: ```yaml # 是否启用自动清理(true/false) # 建议:初始测试时设为 false,确认无误后再启用 # enable_auto_cleanup: true # 自动清理超期草案 enable_auto_cleanup: false # 手动清理(推荐) ``` ### Technical Analysis The cleanup implementation reads `retention_days`, but it never reads or enforces `enable_auto_cleanup`. Calling the `cleanup` command therefore invokes `cleanup_expired_proposals` and permanently deletes every proposal file whose modification time exceeds the retention period, even when `enable_auto_cleanup` is explicitly set to `false`. This behavior conflicts with the documented safety model, which states that automa ...[truncated 1494 chars]- Remediation
View remediation
