T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/extract-transcripts.sh:8- Finding
Transcript extraction ignores the requested time limit and exposes complete conversation history
- Content
View full analysis
Vulnerability Details
File Location:
scripts/extract-transcripts.sh, lines 8-28
Vulnerability Type: Excessive access to sensitive transcript data
Risk Level: MediumVulnerable Code
bash INPUT="${1:?Usage: extract-transcripts.sh <jsonl_file_or_dir> [days_back]}" DAYS_BACK="${2:-7}" # Collect JSONL files FILES=() if [ -d "$INPUT" ]; then while IFS= read -r f; do FILES+=("$f"); done < <(find "$INPUT" -name "*.jsonl" -type f) else FILES=("$INPUT") fi if [ ${#FILES[@]} -eq 0 ]; then echo "No JSONL files found in $INPUT" exit 1 fi # Read all files into a single stream ALL_MESSAGES="" for FILE in "${FILES[@]}"; do ALL_MESSAGES+=$(cat "$FILE") ALL_MESSAGES+=$'\n' doneThe resulting data is later emitted as complete message text:
bash echo "$ALL_MESSAGES" | jq -r ' select(.type == "message" and .message.role == "user") | .timestamp + " | " + (.message.content[] | select(.type == "text") | .text) ' 2>/dev/null | sort || trueTechnical Analysis
The script accepts a
days_backargument and assigns it toDAYS_BACK, but never uses that variable to filter files or individual JSONL records. When given a directory, it recursively discovers every.jsonlfile and concatenates all of their contents intoALL_MESSAGES.This behavior conflicts with the documented invocation in
SKILL.md, which passes1to request transcripts from the past day. Instead, the script processes every transcript available under the supplied directory. It then outputs full user-message text rather than a minimized or redacted summary.Conversation transcripts can contain credentials, access tokens, personal information, proprietary data, or unrelated historical conversations. Although the project contains no mechanism that transmits this data to an external service, the unnecessarily broad data set is exposed to the invoking agent and its active mo ...[truncated 1340 chars]
- Remediation
View remediation
Remediation Suggestions
- Enforce
DAYS_BACKby calculating a trusted cutoff timestamp and filtering each JSONL record by its parsed timestamp before any content is aggregated or displayed. - Validate that
DAYS_BACKis a non-negative integer and reject malformed values. - Prefer record-level timestamp filtering over file modification-time filtering, because a transcript file may contain records from multiple dates.
- Avoid storing the complete transcript corpus in a shell variable. Stream records through
jqto reduce unnecessary retention and memory exposure. - Emit local aggregates, hashes, truncated descriptions, or redacted pattern summaries instead of complete user messages.
- Remove or mask likely credentials, tokens, email addresses, and other sensitive values before output reaches the agent context.
- Restrict accepted input to the intended sessions directory, or require explicit confirmation when another directory is supplied.
- Add automated tests proving that records older than the requested cutoff are excluded.
- Enforce
