Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 764a6c0

Browse files
committedJul 27, 2022
Hide sensitive info from Properties
1 parent 338dc9a commit 764a6c0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎include/kafka/Properties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Properties
7979
const std::string& key = kv.first;
8080
const std::string& value = kv.second;
8181

82-
static const std::regex reSensitiveKey(R"(.+\.password)");
82+
static const std::regex reSensitiveKey(R"(.+\.password|.+\.username)");
8383
bool isSensitive = std::regex_match(key, reSensitiveKey);
8484

8585
ret.append(ret.empty() ? "" : "|").append(key).append("=").append(isSensitive ? "*" : value);

‎tests/unit/TestProperties.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ TEST(Properties, SensitiveProperties)
9090
{{
9191
{ "ssl.key.password", "passwordA" },
9292
{ "ssl.keystore.password", "passwordB" },
93+
{ "sasl.username", "userName" },
9394
{ "sasl.password", "passwordC" },
9495
}};
9596

96-
EXPECT_EQ("sasl.password=*|ssl.key.password=*|ssl.keystore.password=*", props.toString());
97+
EXPECT_EQ("sasl.password=*|sasl.username=*|ssl.key.password=*|ssl.keystore.password=*", props.toString());
9798
}

0 commit comments

Comments
 (0)
Please sign in to comment.