Update main.go, tap.go, and 4 more files...

This commit is contained in:
RamiBerm 2021-07-21 10:49:27 +03:00
parent ef8314b554
commit 80e97e7f7e
6 changed files with 10 additions and 5 deletions

View File

@ -142,7 +142,9 @@ func filterHarItems(inChannel <-chan *tap.OutputChannelItem, outChannel chan *ta
continue continue
} }
if !filterOptions.DisableRedaction {
sensitiveDataFiltering.FilterSensitiveInfoFromHarRequest(message, filterOptions) sensitiveDataFiltering.FilterSensitiveInfoFromHarRequest(message, filterOptions)
}
outChannel <- message outChannel <- message
} }

View File

@ -25,6 +25,7 @@ type MizuTapOptions struct {
HideHealthChecks bool HideHealthChecks bool
MaxEntriesDBSizeBytes int64 MaxEntriesDBSizeBytes int64
SleepIntervalSec uint16 SleepIntervalSec uint16
DisableRedaction bool
} }
var mizuTapOptions = &MizuTapOptions{} var mizuTapOptions = &MizuTapOptions{}
@ -102,4 +103,5 @@ func init() {
tapCmd.Flags().StringVarP(&direction, "direction", "", "in", "Record traffic that goes in this direction (relative to the tapped pod): in/any") tapCmd.Flags().StringVarP(&direction, "direction", "", "in", "Record traffic that goes in this direction (relative to the tapped pod): in/any")
tapCmd.Flags().BoolVar(&mizuTapOptions.HideHealthChecks, "hide-healthchecks", false, "hides requests with kube-probe or prometheus user-agent headers") tapCmd.Flags().BoolVar(&mizuTapOptions.HideHealthChecks, "hide-healthchecks", false, "hides requests with kube-probe or prometheus user-agent headers")
tapCmd.Flags().StringVarP(&humanMaxEntriesDBSize, maxEntriesDBSizeFlagName, "", "200MB", "override the default max entries db size of 200mb") tapCmd.Flags().StringVarP(&humanMaxEntriesDBSize, maxEntriesDBSizeFlagName, "", "200MB", "override the default max entries db size of 200mb")
tapCmd.Flags().BoolVar(&mizuTapOptions.DisableRedaction, "no-redact", false, "Disables redaction of potentially sensitive request/response headers and body values")
} }

View File

@ -126,7 +126,7 @@ func getMizuApiFilteringOptions(tappingOptions *MizuTapOptions) (*shared.Traffic
} }
} }
return &shared.TrafficFilteringOptions{PlainTextMaskingRegexes: compiledRegexSlice, HideHealthChecks: tappingOptions.HideHealthChecks}, nil return &shared.TrafficFilteringOptions{PlainTextMaskingRegexes: compiledRegexSlice, HideHealthChecks: tappingOptions.HideHealthChecks, DisableRedaction: tappingOptions.DisableRedaction}, nil
} }
func updateMizuTappers(ctx context.Context, kubernetesProvider *kubernetes.Provider, nodeToTappedPodIPMap map[string][]string, tappingOptions *MizuTapOptions) error { func updateMizuTappers(ctx context.Context, kubernetesProvider *kubernetes.Provider, nodeToTappedPodIPMap map[string][]string, tappingOptions *MizuTapOptions) error {

View File

@ -14,8 +14,8 @@ import (
core "k8s.io/api/core/v1" core "k8s.io/api/core/v1"
rbac "k8s.io/api/rbac/v1" rbac "k8s.io/api/rbac/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors" k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
resource "k8s.io/apimachinery/pkg/api/resource" resource "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
applyconfapp "k8s.io/client-go/applyconfigurations/apps/v1" applyconfapp "k8s.io/client-go/applyconfigurations/apps/v1"
@ -118,7 +118,7 @@ func (provider *Provider) CreateMizuAggregatorPod(ctx context.Context, namespace
Value: string(marshaledFilteringOptions), Value: string(marshaledFilteringOptions),
}, },
{ {
Name: shared.MaxEntriesDBSizeByteSEnvVar, Name: shared.MaxEntriesDBSizeBytesEnvVar,
Value: strconv.FormatInt(maxEntriesDBSizeBytes, 10), Value: strconv.FormatInt(maxEntriesDBSizeBytes, 10),
}, },
}, },

View File

@ -5,5 +5,5 @@ const (
HostModeEnvVar = "HOST_MODE" HostModeEnvVar = "HOST_MODE"
NodeNameEnvVar = "NODE_NAME" NodeNameEnvVar = "NODE_NAME"
TappedAddressesPerNodeDictEnvVar = "TAPPED_ADDRESSES_PER_HOST" TappedAddressesPerNodeDictEnvVar = "TAPPED_ADDRESSES_PER_HOST"
MaxEntriesDBSizeByteSEnvVar = "MAX_ENTRIES_DB_BYTES" MaxEntriesDBSizeBytesEnvVar = "MAX_ENTRIES_DB_BYTES"
) )

View File

@ -60,6 +60,7 @@ func CreateWebSocketMessageTypeAnalyzeStatus(analyzeStatus AnalyzeStatus) WebSoc
type TrafficFilteringOptions struct { type TrafficFilteringOptions struct {
PlainTextMaskingRegexes []*SerializableRegexp PlainTextMaskingRegexes []*SerializableRegexp
HideHealthChecks bool HideHealthChecks bool
DisableRedaction bool
} }
type VersionResponse struct { type VersionResponse struct {