Skip to content

fix(security): redact every live turn event before the preview cut - #695

Merged
ajianaz merged 3 commits into
developfrom
security/redact-live-previews
Nov 13, 2026
Merged

ajianaz merged 3 commits into
developfrom
security/redact-live-previews

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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_started input, the tool_finished preview 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.rs passed the RAW tool input and the first 200 characters of the RAW output or error to TurnObserver. The observers forward these as is: tole serve's GET /sessions/{id}/events tool_started / tool_finished frames, ACP tool_call_update and 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. JsonlStorage returns its own redaction set (the one set_secrets installs, else the process set), so the live events and the log use the same secrets.
  • turn.rs:
    • tool_started receives set.redact_value(&input).
    • The tool_finished preview is short_preview(redacted): redact_value for an output, redact for an error. It is redacted first and cut after.
    • reasoning is redacted too.
    • The set is fetched only when an observer is attached, so runs without an observer pay nothing.
    • short_preview now takes the already-redacted string, so a raw value cannot be passed to it by accident.
  • Docs: the threat-model egress row lists the live turn events, and a CHANGELOG Security entry.

Decisions to check

  • Streamed answer text (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.
  • One fetch per tool call. egress_secrets() is fetched once per tool call when an observer is present: an Arc clone, no rebuild.

Testing

  • New 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.
    • The durable log holds no value.
    • None of the started, finished (ok and error) and reasoning events contains the value or even its first 6 characters.
    • The events show «GITHUB_TOKEN».
    • The fake token is assembled at run time, so no token literal sits in the source.
  • Red on develop and mutation checks, each run and each failing as expected:
    • cutting before redacting (a partial secret leaks);
    • a raw tool_started input;
    • raw reasoning.
  • Gates on the merged head:
    • cargo fmt --all --check
    • cargo clippy --workspace --all-targets --all-features -- -D warnings
    • cargo test --workspace
    • cargo test -p tole-core --no-default-features
    • cargo test -p tole-cli --no-default-features --features shell-tools
    • cora review --no-llm --base origin/develop (no issues)

Closes #677

@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 49bc25b into develop Nov 13, 2026
19 checks passed
@ajianaz
ajianaz deleted the security/redact-live-previews branch November 20, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security(serve): live tool-result previews bypass SecretSet (serve SSE, ACP, TUI)

2 participants