T09 · Insecure Skill Coding Practices
- Location
compress.sh:744- Finding
Selected Session Context Is Injected into the Fixed Main Session
- Content
View full analysis
/dev/null) ``` ```bash if $do_replace; then echo "" echo -e "${YELLOW}🔄 Resetting session and injecting compressed context...${NC}" local old_session_id="$SESSION_ID" local state_dir="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}" local jsonl_file="$state_dir/agents/$AGENT_ID/sessions/$SESSION_ID.jsonl" # Backup the JSONL file before deleting if [[ -f "$jsonl_file" ]]; then local backup_file="$COMPRESSED_DIR/$timestamp.session-backup.jsonl" echo " Backing up session file..." cp "$jsonl_file" "$backup_file" echo " Backup saved: $backup_file" # Delete the JSONL to reset the session (official method per docs) echo " Deleting session JSONL to reset..." rm "$jsonl_file" else echo -e "${YELLOW} Warning: Session file not found, skipping backup${NC}" fi # Wait a moment for the system to recognize the deletion sleep 1 # Inject the summary - this will create a fresh session local context_msg="[COMPRESSED CONTEXT - Session was compressed on $(date -Iseconds)] The following is a summary of the previous conversation. Use this to continue the work: --- $summary_text --- Please acknowledge that you have received this compressed context and are ready to continue." echo " Injecting compressed context into fresh session..." local inject_response inject_response=$(openclaw agent --to main -m "$context_msg" --json 2>/dev/null) ``` ### Technical Analysis The script allows the operator to select a session by key or ID. It correctly sends the summarization request to the selected session through `--session-id "$SE ...[truncated 2304 chars]- Remediation
View remediation
