Skip to content

fix: redact output of credential tools #500

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

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func (r *Runner) resume(callCtx engine.Context, monitor Monitor, env []string, s
Time: time.Now(),
CallContext: callCtx.GetCallContext(),
Type: EventTypeCallFinish,
Content: *state.Continuation.Result,
Content: getFinishEventContent(*state, callCtx),
})
if callCtx.Tool.Chat {
return &State{
Expand Down Expand Up @@ -786,6 +786,15 @@ func (r *Runner) subCalls(callCtx engine.Context, monitor Monitor, env []string,
return state, callResults, nil
}

func getFinishEventContent(state State, callCtx engine.Context) string {
// If it is a credential tool, the finish event contains its output, which is sensitive, so we don't return it.
if callCtx.ToolCategory == engine.CredentialToolCategory {
return ""
}

return *state.Continuation.Result
}

func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env []string) ([]string, error) {
// Since credential tools (usually) prompt the user, we want to only run one at a time.
r.credMutex.Lock()
Expand Down