Skip to content

Commit

Permalink
BE: Sanitize connection.uri for mongo (kafbat#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav7261 authored Apr 11, 2024
1 parent 38c446d commit 4a3c424
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class KafkaConfigSanitizer {
.add(
"basic.auth.user.info", /* For Schema Registry credentials */
"password", "secret", "token", "key", ".*credentials.*", /* General credential patterns */
"aws.access.*", "aws.secret.*", "aws.session.*" /* AWS-related credential patterns */
"aws.access.*", "aws.secret.*", "aws.session.*", /* AWS-related credential patterns */
"connection.uri" /* mongo credential patterns */
)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ void obfuscateCredentials() {
assertThat(sanitizer.sanitize("aws.secret.access.key", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("aws.secretAccessKey", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("aws.sessionToken", "secret")).isEqualTo("******");

//Mongo var sanitizing
assertThat(sanitizer.sanitize("connection.uri", "secret")).isEqualTo("******");
}

@Test
Expand Down

0 comments on commit 4a3c424

Please sign in to comment.