Repository navigation
Redact secret_request values from transcripts, pushes and memory (#1531) #1555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ const fs = require("node:fs"); | |
| const path = require("node:path"); | ||
| const { randomUUID } = require("node:crypto"); | ||
| const { getDefaultSecrets } = require("./secrets.js"); | ||
| const threadSecrets = require("./threadSecrets.js"); | ||
| const { | ||
| splitMessagesByThread, | ||
| stringifyStore, | ||
|
|
@@ -2073,7 +2074,10 @@ class Store { | |
| */ | ||
| appendMessage(threadId, message) { | ||
| const list = this.getMessages(threadId).slice(); | ||
| list.push(message); | ||
| // Every runner/adapter message write lands here or in updateMessage, and | ||
| // the renderer push, summaries and session transcript read back from the | ||
| // store, so redacting here covers them all (#1531 secret_request). | ||
| list.push(threadSecrets.redact(threadId, message)); | ||
|
Comment on lines
+2077
to
+2080
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a provider prints a requested secret to stderr and exits nonzero, Useful? React with 👍 / 👎. |
||
| this.setMessages(threadId, list); | ||
| this.updateThread(threadId, {}, { touch: true }); | ||
| } | ||
|
|
@@ -2311,7 +2315,9 @@ class Store { | |
| const list = this.getMessages(threadId).slice(); | ||
| const idx = list.findIndex((m) => m.id === messageId); | ||
| if (idx < 0) return null; | ||
| list[idx] = { ...list[idx], ...patch }; | ||
| // Streams patch the whole accumulated text, so a value split across | ||
| // chunks is caught once both halves have arrived. | ||
| list[idx] = { ...list[idx], ...threadSecrets.redact(threadId, patch) }; | ||
| this.setMessages(threadId, list); | ||
| return list[idx]; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a secret crosses the 1,200-character boundary in the final run text,
buildRunBodytruncates it first, leaving only a prefix that the later exact-value replacement cannot recognize; that raw secret prefix is then posted to shared memory. This is especially significant for long credentials such as PEM values. Redactoutcome.textbeforebuildRunBodyslices it rather than redacting only the completed payload.Useful? React with 👍 / 👎.