Skip to content

fix(ai): Redact session input and gate state-changing tools on approval#188

Merged
nfebe merged 2 commits into
mainfrom
fix/ai-session-redaction
Jul 23, 2026
Merged

fix(ai): Redact session input and gate state-changing tools on approval#188
nfebe merged 2 commits into
mainfrom
fix/ai-session-redaction

Conversation

@nfebe

@nfebe nfebe commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Found while wiring the file editors to the assistant (flatrun/ui#71), two gaps in the "live editing" story.

Content seeded into a session from the UI, a file being edited or pasted output, reached the model provider verbatim. The analyze endpoints already redact known secret values before anything leaves the server; the session path now does the same.

An auto-run session also executed every tool without a pause, including state-changing ones, gated only by the caller's permissions. A tool batch containing a state-changing call now always waits for per-call operator approval: reads run free, writes ask first.

nfebe added 2 commits July 22, 2026 09:05
Content seeded into an assistant session from the UI, such as a file
being edited or pasted command output, was sent to the model provider
verbatim. Known secret values and credential-shaped assignments are now
stripped from it before it enters the transcript, matching the guarantee
the analyze endpoints already made: secrets never leave the server.
An auto-run session executed every tool without a pause, including ones
that change state, gated only by the caller's permissions. Now a tool
batch containing a state-changing call always waits for per-call
operator approval, in every session: reads run free, writes ask first.
@sourceant

sourceant Bot commented Jul 23, 2026

Copy link
Copy Markdown

Code Review Summary

This PR improves the security of AI sessions by redacting secrets from input context and enforcing manual approval for all state-changing tools, even when auto-run is enabled. This ensures sensitive credentials stay internal and hazardous operations remain under human control.

🚀 Key Improvements

  • Input redaction for all session messages and context via redactSessionInput.
  • Mandatory human approval gate for tools marked with Mutates: true.
  • Categorization of existing file editing and control tools as mutating operations.

💡 Minor Suggestions

  • Ensure system secrets are merged with deployment secrets during redaction.
  • Optimization to skip redaction logic when no secrets are defined.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

@nfebe
nfebe merged commit 38b6001 into main Jul 23, 2026
6 checks passed
@nfebe
nfebe deleted the fix/ai-session-redaction branch July 23, 2026 09:15
@nfebe nfebe mentioned this pull request Jul 23, 2026
43 tasks
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.

1 participant