Skip to content

Commit 3111fe8

Browse files
committed
Improve Security
1 parent b5f3b40 commit 3111fe8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

include/kafka/Properties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class Properties
160160
const std::string& key = kv.first;
161161
const std::string value = kv.second.toString();
162162

163-
static const std::regex reSensitiveKey(R"(.+\.password|.+\.username|.+secret)");
163+
static const std::regex reSensitiveKey(R"(.+\.password|.+\.username|.+secret|.+key|.+pem)");
164164
const bool isSensitive = std::regex_match(key, reSensitiveKey);
165165

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

tests/unit/TestProperties.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ TEST(Properties, SensitiveProperties)
120120
{ "ssl.keystore.password", { "passwordB" } },
121121
{ "sasl.username", { "userName" } },
122122
{ "sasl.password", { "passwordC" } },
123+
{ "ssl.key.pem", { "pem" } },
124+
{ "ssl_key", { "key" } },
123125
}};
124126

125-
EXPECT_EQ("sasl.password=*|sasl.username=*|ssl.key.password=*|ssl.keystore.password=*", props.toString());
127+
EXPECT_EQ("sasl.password=*|sasl.username=*|ssl.key.password=*|ssl.key.pem=*|ssl.keystore.password=*|ssl_key=*", props.toString());
126128
}

0 commit comments

Comments
 (0)