by Rygian · 2y ago · 0 comments
I wonder if this code has proper masking in place for logs. The following line is not reassuring:
slog.Info("received message", "message", fmt.Sprintf("%x", rawMessage))``` // to make it right, let's filter the value of CVV field when we output it filterCVV := iso8583.FilterField("8", iso8583.FilterFunc(func(in string, data field.Field) string { if len(in) == 0 { return in } return in[0:1] + strings.Repeat("*", len(in)-1) }))
// don't forget to apply default filter filters := append(iso8583.DefaultFilters(), filterCVV)
err = iso8583.Describe(requestMessage, os.Stdout, filters...) require.NoError(t, err) ```