package natsb import ( "strings" "testing" ) func TestLogsRedactNATSCredentials(t *testing.T) { for _, url := range []string{"nats://secret-user:secret-password@localhost:4222", "nats://secret-token@localhost:4222", "nats://localhost:4222?token=secret-token", "invalid secret-password"} { safe := buildSafePublishableNATSURL(url) if strings.Contains(safe, "secret") { t.Fatalf("credential leaked: %q", safe) } } }