Plugin implementing a listener to mask secrets in the console?

30 views
Skip to first unread message

Cyrille Le Clerc

unread,
Aug 18, 2021, 4:03:59 PM8/18/21
to Jenkins Developers
Dear community,

In the Jenkins OpenTelemetry plugin, we want to optionally inject in shell & bat steps some OpenTelemetry configuration environment variables that contains secrets and we would like to mask those credentials in the console the same way the `withCredentials` step does it.

We identified that the `withCredentials` step creates a new BodyInvoker on `o.j.p.w.steps.StepExecution#start()` (see here).

Is it possible implementing a `o.j.p.w.flow.StepListener#notifyOfNewStep()` or `o.j.p.w.flow.GraphListener#onNewHead()` to mask passwords in shell & bat steps? Are their limitations that would prevent it?

Implementing `StepListener#notifyOfNewStep(step, stepContext)` seems to provide access to the needed `stepContent`.

Cyrille

Jesse Glick

unread,
Aug 20, 2021, 7:29:28 AM8/20/21
to Jenkins Dev
Reply all
Reply to author
Forward
0 new messages