other
- Location
scripts/opencode_sessions.py:547- Finding
Sensitive Local Conversation and Tool Payload Disclosure
- Content
View full analysis
Vulnerability Details
File Location:
scripts/opencode_sessions.py:547-596,scripts/opencode_sessions.py:680-718, andscripts/opencode_sessions.py:1002-1018
Vulnerability Type: Sensitive local conversation access
Risk Level: MediumComplete Code Snippet
python def load_transcript( connection: sqlite3.Connection, capabilities: Capabilities, session_id: str, ) -> list[MessageRecord]: require_capability(capabilities, "message") require_capability(capabilities, "part") message_rows = connection.execute( """ SELECT id, time_created, data FROM message WHERE session_id = ? ORDER BY time_created ASC, id ASC """, (session_id,), ).fetchall() messages: list[MessageRecord] = [] by_id: dict[str, MessageRecord] = {} for row in message_rows: raw = str(row["data"]) payload = safe_json_loads(raw) message = MessageRecord( id=str(row["id"]), created_ms=int(row["time_created"]), role=str((payload or {}).get("role") or "unknown"), model_id=string_or_none((payload or {}).get("modelID")), provider_id=string_or_none((payload or {}).get("providerID")), payload=payload, raw_data=raw, ) messages.append(message) by_id[message.id] = message for row in connection.execute( """ SELECT id, message_id, time_created, data FROM part WHERE session_id = ? ORDER BY message_id ASC, time_created ASC, id ASC """, (session_id,), ): message = by_id.get(str(row["message_id"])) if message is None: continue raw = str(row["data"]) payload = safe_json_loads(raw) message.parts.append( PartRecord( id=str(row[" ...[truncated 4236 chars]- Remediation
View remediation
Remediation Suggestions
- Require a separate interactive confirmation immediately before reading or exporting complete payloads. Show the resolved database path, selected session IDs, destination, and categories of sensitive fields first.
- Refuse
--include-sensitivein non-interactive execution unless a second explicit acknowledgement flag is supplied. - Add default redaction for common secret patterns and fields, including tokens, API keys, authorization headers, passwords, cookies, and private keys.
- Allow users to select specific payload fields instead of exposing complete raw message and part objects.
- Disable implicit Skill invocation for sensitive transcript operations or require explicit user authorization before
showandexport. - Create export files with restrictive owner-only permissions and verify destination-directory permissions before writing.
- Emit a clear warning that standard output may be captured by shell history, CI logs, agent traces, or downstream tools.
- Provide a metadata-only preview that lists selected sessions and estimated disclosure scope before transcript data is loaded.
- Preserve the existing read-only SQLite protections, parameterized queries, full-export acknowledgement, and overwrite safeguards.
