Skip to content

Commit f8d3b44

Browse files
authored
fix: redact output of credential tools (#500)
Signed-off-by: Grant Linville <[email protected]>
1 parent 721d518 commit f8d3b44

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/runner/runner.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ func (r *Runner) resume(callCtx engine.Context, monitor Monitor, env []string, s
542542
Time: time.Now(),
543543
CallContext: callCtx.GetCallContext(),
544544
Type: EventTypeCallFinish,
545-
Content: *state.Continuation.Result,
545+
Content: getFinishEventContent(*state, callCtx),
546546
})
547547
if callCtx.Tool.Chat {
548548
return &State{
@@ -786,6 +786,15 @@ func (r *Runner) subCalls(callCtx engine.Context, monitor Monitor, env []string,
786786
return state, callResults, nil
787787
}
788788

789+
func getFinishEventContent(state State, callCtx engine.Context) string {
790+
// If it is a credential tool, the finish event contains its output, which is sensitive, so we don't return it.
791+
if callCtx.ToolCategory == engine.CredentialToolCategory {
792+
return ""
793+
}
794+
795+
return *state.Continuation.Result
796+
}
797+
789798
func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env []string) ([]string, error) {
790799
// Since credential tools (usually) prompt the user, we want to only run one at a time.
791800
r.credMutex.Lock()

0 commit comments

Comments
 (0)