Skip to content

Commit 50e1d16

Browse files
committed
fix: redact output of credential tools
Signed-off-by: Grant Linville <[email protected]>
1 parent 2aafa62 commit 50e1d16

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

pkg/runner/monitor.go

+19
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,22 @@ func (n noopMonitor) Stop(string, error) {}
2828
func (n noopMonitor) Pause() func() {
2929
return func() {}
3030
}
31+
32+
type credWrapper struct {
33+
m Monitor
34+
}
35+
36+
func (n credWrapper) Event(e Event) {
37+
if e.Type == EventTypeCallFinish {
38+
e.Content = "credential tool output redacted"
39+
}
40+
n.m.Event(e)
41+
}
42+
43+
func (n credWrapper) Stop(s string, err error) {
44+
n.m.Stop(s, err)
45+
}
46+
47+
func (n credWrapper) Pause() func() {
48+
return n.m.Pause()
49+
}

pkg/runner/runner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
858858
return nil, fmt.Errorf("failed to create subcall context for tool %s: %w", credToolName, err)
859859
}
860860

861-
res, err := r.call(subCtx, monitor, env, input)
861+
res, err := r.call(subCtx, credWrapper{monitor}, env, input)
862862
if err != nil {
863863
return nil, fmt.Errorf("failed to run credential tool %s: %w", credToolName, err)
864864
}

0 commit comments

Comments
 (0)