engine: redact dynamic secrets (e.g. #NewSecret)
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
5f840723e2
commit
a61291a887
@ -213,8 +213,10 @@ func (c *Client) logSolveStatus(ctx context.Context, pctx *plancontext.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Just like sprintf, but redacts secrets automatically
|
// Just like sprintf, but redacts secrets automatically
|
||||||
secrets := pctx.Secrets.List()
|
|
||||||
secureSprintf := func(format string, a ...interface{}) string {
|
secureSprintf := func(format string, a ...interface{}) string {
|
||||||
|
// Load a fresh copy of secrets (since they can be dynamically added).
|
||||||
|
secrets := pctx.Secrets.List()
|
||||||
|
|
||||||
s := fmt.Sprintf(format, a...)
|
s := fmt.Sprintf(format, a...)
|
||||||
for _, secret := range secrets {
|
for _, secret := range secrets {
|
||||||
s = strings.ReplaceAll(s, secret.PlainText(), "***")
|
s = strings.ReplaceAll(s, secret.PlainText(), "***")
|
||||||
|
Reference in New Issue
Block a user