Skip to content

Commit

Permalink
Redact token from error log
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Laine committed May 10, 2021
1 parent 57370cc commit ffc60b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/server/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import (
"context"
"crypto/x509"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"regexp"
"strings"
"time"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -222,7 +224,9 @@ func (s *EventServer) handleEvent() func(w http.ResponseWriter, r *http.Request)

go func(n notifier.Interface, e events.Event) {
if err := n.Post(e); err != nil {
s.logger.Error(err, "failed to send notification",
redacted := strings.ReplaceAll(err.Error(), token, "*****")
redactedErr := errors.New(redacted)
s.logger.Error(redactedErr, "failed to send notification",
"reconciler kind", event.InvolvedObject.Kind,
"name", event.InvolvedObject.Name,
"namespace", event.InvolvedObject.Namespace)
Expand Down

0 comments on commit ffc60b2

Please sign in to comment.