Repository navigation
fix(security): redact every live turn event before the preview cut - #695
Merged
Merged
Conversation
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Every live turn event an observer receives is now redacted with the session's own secret set, the same set the session log is redacted with. The events are the
tool_startedinput, thetool_finishedpreview of an output or error, and the reasoning. Redaction happens once in the turn loop, before the 200-character preview cut, so serve SSE, ACP and the TUI are all covered.Why
#677 (audit of #594):
turn.rspassed the RAW tool input and the first 200 characters of the RAW output or error toTurnObserver. The observers forward these as is:tole serve'sGET /sessions/{id}/eventstool_started/tool_finishedframes, ACPtool_call_updateand the TUI. Meanwhile #596 redacts the durable entry of the same tool call. A remote client following a session, or any proxy or log in between, saw the secret the log hides. A cut before redaction could also leave a partial, unmatchable value.Changes
Storage::egress_secrets(): a new trait method with a default of the process set.JsonlStoragereturns its own redaction set (the oneset_secretsinstalls, else the process set), so the live events and the log use the same secrets.turn.rs:tool_startedreceivesset.redact_value(&input).tool_finishedpreview isshort_preview(redacted):redact_valuefor an output,redactfor an error. It is redacted first and cut after.reasoningis redacted too.short_previewnow takes the already-redacted string, so a raw value cannot be passed to it by accident.Decisions to check
text_delta) is not redacted live. It comes from the provider's delta sinks, not the turn loop, and is model output, which only ever saw redacted input. Its committed entry is redacted. This is written down as a residual in the threat model and the CHANGELOG.egress_secrets()is fetched once per tool call when an observer is present: anArcclone, no rebuild.Testing
crates/tole-core/tests/live_preview_redaction.rs(the audit's reproduction, widened). A ReadOnly tool returns the secret straddling the 200-character cut, a second tool fails with it in its error, the call input carries it, and the provider's reasoning holds it.started,finished(ok and error) andreasoningevents contains the value or even its first 6 characters.«GITHUB_TOKEN».tool_startedinput;cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspacecargo test -p tole-core --no-default-featurescargo test -p tole-cli --no-default-features --features shell-toolscora review --no-llm --base origin/develop(no issues)Closes #677