You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG/SECURITY]: redacted secrets persist in cleartext in the opencode.db event journal #52586
Secret redaction doesn't cover the event journal in opencode.db. The redaction hook (tool.execute.after) fires once, after a tool completes — but streaming tools (bash/shell) write their raw output to the event table on every chunk while still running, before any hook can touch it. So the final completed row and the part row are redacted, but every intermediate running row keeps the raw, un-redacted output. The event table has no prune/expiry, so those cleartext secrets persist for the life of the DB.
Net effect: a user who turns on redaction sees clean model context and clean session history, but their API keys/tokens still sit in cleartext inside the same opencode.db — and travel with any backup/sync/copy of it. It's local-at-rest (not a remote exploit), but it's a security feature silently not applying to a durable store.
No plugin can fix this: there's no mutation-capable hook before the event INSERT (commitDurableEvent in packages/core/src/event.ts). The event plugin hook is a read-only post-commit listener.
Steps to reproduce
Run a streaming shell tool whose output contains a secret-shaped value (e.g. a command that prints an API key).
While it's running, OpenCode writes message.part.updated.1 events to the event table with the raw output in state.metadata.output.
Query the event table in opencode.db for running-status tool-part rows — the raw value is present in cleartext, and stays there permanently (no prune path).
The completed row and the part row are correctly redacted; only the intermediate running event rows retain the raw value.
Possible fixes (any one): a pre-INSERT transform hook in the event-store commit (this is the intent of the closed-unimplemented #28223); server-side redaction/truncation of streaming payloads before journaling; or retention/prune on the event table.
Thanks for the report! In OpenCode 2.0 shell output is streamed to files instead of being stored in the event journal, so this no longer applies. If you still see this on the latest OpenCode, please open a new issue with details. Closing as completed.
Activity
github-actions commentedon Oct 1, 2026
This issue might be a duplicate of or overlap with existing issues. Please check:
tool.execute.aftercan redact it.eventtable has no retention or pruning; its primary symptom is unbounded database growth.Tarquinen commentedon Oct 20, 2026
Thanks for the report! In OpenCode 2.0 shell output is streamed to files instead of being stored in the event journal, so this no longer applies. If you still see this on the latest OpenCode, please open a new issue with details. Closing as completed.
— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊