T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- agents/openai.yaml:1
- Finding
- Implicit Invocation Enables Broad Access to Local OpenCode Conversation History## Vulnerability Details **File Location**: `agents/openai.yaml:1-7`; `SKILL.md:109-119`; `SKILL.md:155-163` **Vulnerability Type**: Excessive access to sensitive local session data **Risk Level**: Medium ### Vulnerable Code `agents/openai.yaml:1-7` ```yaml interface: display_name: "OpenCode Session Reader" short_description: "Query local OpenCode SQLite sessions safely." default_prompt: "Use $opencode-session-reader to list recent OpenCode sessions, then inspect message JSON for a target directory." policy: allow_implicit_invocation: true ``` `SKILL.md:109-119` ```bash **跨所有目录全量列出 session(带 project 信息)** ```bash sqlite3 -readonly "$DB_PATH" \ "SELECT s.id, s.title, s.directory, p.worktree, datetime(s.time_updated/1000,'unixepoch','localtime') as updated FROM session s LEFT JOIN project p ON s.project_id = p.id ORDER BY s.time_updated DESC LIMIT 50;" | column -t -s '|' ``` ``` `SKILL.md:155-163` ```bash **查看某 session 的消息内容** ```bash sqlite3 -readonly -json "$DB_PATH" \ "SELECT m.id, datetime(m.time_created/1000,'unixepoch','localtime') as created, m.data FROM message m WHERE m.session_id = 'your-session-id' ORDER BY m.time_created ASC;" ``` ``` ### Technical Analysis The skill is configured for implicit invocation while its default workflow lists local OpenCode sessions and inspects complete message JSON. The documented cross-directory query has no project or directory restriction, allowing the agent to enumerate sessions from all projects represented in the database. A subsequent query returns the complete `message.data` value for a selected session. SQLite read-only mode prevents database modification, but it does not limit disclosure. OpenCode conversation records may contain prompts, source code, command output, local paths, credentials pasted into messages, or other sensitive project information. The combination of broad e ...[truncated 1421 chars]
- Remediation
- ## Remediation Suggestions 1. Set `allow_implicit_invocation` to `false` for this privacy-sensitive skill. 2. Require explicit user confirmation before opening the OpenCode database or reading message bodies. 3. Require the user to approve a specific project, directory, and session before querying content. 4. Apply project or directory restrictions directly in every session query instead of enumerating all projects by default. 5. Return only minimal session metadata initially. Place message-body retrieval behind a separate confirmation step. 6. Redact likely credentials, tokens, private keys, and other secrets before message data enters the model context or output. 7. Record the selected scope in the response so the user can verify which database, project, and session were accessed.
