This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git
The following commit(s) were added to refs/heads/main by this push:
new 0cf73cba06 Fix #1874: Mask the options of type PASSWORD in the startup
properties log (#1875)
0cf73cba06 is described below
commit 0cf73cba06282b4104996f0eceacb72e0a914383
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 19 09:53:47 2026 +0100
Fix #1874: Mask the options of type PASSWORD in the startup properties log
(#1875)
The task logs the properties it starts with and masked only the keys Camel
knows as sensitive. Options a connector defines with the Kafka type
PASSWORD,
such as privateKeyPassphrase or oauth2ClientSecret, are now masked too: the
connector passes the names of its PASSWORD options to its tasks, which also
mask the PASSWORD options of their own configuration.
Signed-off-by: Claus Ibsen <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel/kafkaconnector/CamelConnectorConfig.java | 7 ++
.../camel/kafkaconnector/CamelSinkConnector.java | 17 +--
.../apache/camel/kafkaconnector/CamelSinkTask.java | 4 +
.../camel/kafkaconnector/CamelSourceConnector.java | 17 +--
.../camel/kafkaconnector/CamelSourceTask.java | 4 +
.../utils/CamelKafkaConnectMain.java | 19 ++++
.../camel/kafkaconnector/utils/TaskHelper.java | 49 +++++++++
.../utils/StartupPropertiesLoggingTest.java | 119 +++++++++++++++++++++
docs/modules/ROOT/pages/security-model.adoc | 14 +--
9 files changed, 228 insertions(+), 22 deletions(-)
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java
index cee3ae360f..183767da18 100644
---
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java
+++
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java
@@ -110,6 +110,13 @@ public abstract class CamelConnectorConfig extends
AbstractConfig {
public static final String CAMEL_CONNECTOR_DUMP_ROUTES_DOC = "Whether to
log the Camel routes of the task as XML when it starts."
+ " Camel resolves property placeholders in the dump, so it can
contain configuration values";
+ /**
+ * Not an option for users: the connector sets it in the configuration of
its tasks, to the comma separated names of
+ * the options it defines with the type {@link ConfigDef.Type#PASSWORD}. A
task masks the values of these options
+ * when it logs the properties it starts with, whatever their names.
+ */
+ public static final String CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF =
"camel.connector.passwordProperties";
+
protected CamelConnectorConfig(ConfigDef definition, Map<?, ?> originals,
Map<String, ?> configProviderProps, boolean doLog) {
super(definition, originals, configProviderProps, doLog);
}
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnector.java
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnector.java
index 04a5213884..ab37bec7e7 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnector.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnector.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.camel.kafkaconnector.utils.TaskHelper;
import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.sink.SinkConnector;
@@ -56,16 +57,16 @@ public class CamelSinkConnector extends SinkConnector {
@Override
public List<Map<String, String>> taskConfigs(int maxTasks) {
LOG.info("Setting task configurations for {} workers.", maxTasks);
- Map<String, String> defaults = getConnectorDefaults();
+ Map<String, String> taskProps = new HashMap<>(getConnectorDefaults());
+ taskProps.putAll(configProps);
+ // the task only knows the options of the base configuration, so it is
told which options are passwords
+ String passwordProperties = TaskHelper.passwordPropertyNames(config(),
taskProps);
+ if (!passwordProperties.isEmpty()) {
+
taskProps.put(CamelConnectorConfig.CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF,
passwordProperties);
+ }
final List<Map<String, String>> configs = new ArrayList<>(maxTasks);
for (int i = 0; i < maxTasks; ++i) {
- if (defaults.isEmpty()) {
- configs.add(configProps);
- } else {
- Map<String, String> merged = new HashMap<>(defaults);
- merged.putAll(configProps);
- configs.add(merged);
- }
+ configs.add(taskProps);
}
return configs;
}
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
index 77795ec467..96ed9b6115 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
@@ -21,6 +21,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
@@ -89,6 +90,8 @@ public class CamelSinkTask extends SinkTask {
LOG.info("Starting CamelSinkTask connector task");
Map<String, String> actualProps =
TaskHelper.combineDefaultAndLoadedProperties(getDefaultConfig(), props);
CamelSinkConnectorConfig config =
getCamelSinkConnectorConfig(actualProps);
+ // the values of these options are masked when the properties of
the task are logged
+ final Set<String> passwordProperties =
TaskHelper.takePasswordPropertyNames(config, actualProps);
if (context != null) {
try {
@@ -152,6 +155,7 @@ public class CamelSinkTask extends SinkTask {
cms = CamelKafkaConnectMain.builder(LOCAL_URL, sinkKamelet)
.withRemoveHeadersFirst(true)
.withProperties(actualProps)
+ .withPasswordProperties(passwordProperties)
.withUnmarshallDataFormat(unmarshaller)
.withMarshallDataFormat(marshaller)
.withAggregationStrategyDecorator(configured -> new
DeliveryTrackingAggregationStrategy(configured, this::onAggregatedExchangeDone))
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceConnector.java
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceConnector.java
index 6b7c27d412..f9108c0b5c 100644
---
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceConnector.java
+++
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceConnector.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.camel.kafkaconnector.utils.TaskHelper;
import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.source.SourceConnector;
@@ -56,16 +57,16 @@ public class CamelSourceConnector extends SourceConnector {
@Override
public List<Map<String, String>> taskConfigs(int maxTasks) {
LOG.info("Setting task configurations for {} workers.", maxTasks);
- Map<String, String> defaults = getConnectorDefaults();
+ Map<String, String> taskProps = new HashMap<>(getConnectorDefaults());
+ taskProps.putAll(configProps);
+ // the task only knows the options of the base configuration, so it is
told which options are passwords
+ String passwordProperties = TaskHelper.passwordPropertyNames(config(),
taskProps);
+ if (!passwordProperties.isEmpty()) {
+
taskProps.put(CamelConnectorConfig.CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF,
passwordProperties);
+ }
final List<Map<String, String>> configs = new ArrayList<>(maxTasks);
for (int i = 0; i < maxTasks; ++i) {
- if (defaults.isEmpty()) {
- configs.add(configProps);
- } else {
- Map<String, String> merged = new HashMap<>(defaults);
- merged.putAll(configProps);
- configs.add(merged);
- }
+ configs.add(taskProps);
}
return configs;
}
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
index dbc330871f..04c97661c2 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.CamelContext;
@@ -93,6 +94,8 @@ public class CamelSourceTask extends SourceTask {
LOG.info("Starting CamelSourceTask connector task");
Map<String, String> actualProps =
TaskHelper.combineDefaultAndLoadedProperties(getDefaultConfig(), props);
CamelSourceConnectorConfig config =
getCamelSourceConnectorConfig(actualProps);
+ // the values of these options are masked when the properties of
the task are logged
+ final Set<String> passwordProperties =
TaskHelper.takePasswordPropertyNames(config, actualProps);
String levelStr =
config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_CONTENT_LOG_LEVEL_CONF);
try {
@@ -170,6 +173,7 @@ public class CamelSourceTask extends SourceTask {
cms = CamelKafkaConnectMain.builder(sourceKamelet, localUrl)
.withProperties(actualProps)
+ .withPasswordProperties(passwordProperties)
.withUnmarshallDataFormat(unmarshaller)
.withMarshallDataFormat(marshaller)
.withAggregationSize(size)
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java
b/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java
index 844477b4a9..044408a1e3 100644
---
a/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java
+++
b/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java
@@ -16,11 +16,14 @@
*/
package org.apache.camel.kafkaconnector.utils;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
@@ -106,6 +109,7 @@ public class CamelKafkaConnectMain extends SimpleMain {
private final String from;
private final String to;
private Map<String, String> props;
+ private Set<String> passwordProperties = Collections.emptySet();
private String marshallDataFormat;
private String unmarshallDataFormat;
private int aggregationSize;
@@ -138,6 +142,17 @@ public class CamelKafkaConnectMain extends SimpleMain {
return this;
}
+ /**
+ * The names of the properties whose values are passwords, such as the
options a connector defines with the
+ * type PASSWORD. Their values are masked when the properties are
logged, whatever their names.
+ *
+ * @param passwordProperties the names of the password properties.
+ */
+ public Builder withPasswordProperties(Collection<String>
passwordProperties) {
+ this.passwordProperties = passwordProperties == null ?
Collections.emptySet() : new HashSet<>(passwordProperties);
+ return this;
+ }
+
public Builder withMarshallDataFormat(String dataformatId) {
this.marshallDataFormat = dataformatId;
return this;
@@ -275,7 +290,11 @@ public class CamelKafkaConnectMain extends SimpleMain {
// only checks the last segment of a key, which misses secrets
such as sasl.jaas.config or ssl.keystore.key,
// and the options of a custom login module or callback handler
can be called anything. The Kafka clients
// log the configuration they use themselves, with their own
password masking.
+ // The options a connector defines with the type PASSWORD are
masked whatever their name as well: Kafka
+ // Connect hides them in its own logs, and many of them
(passphrases, client secrets, webhook URLs) are not
+ // names SensitiveUtils knows.
if (SensitiveUtils.containsSensitive(key)
+ || passwordProperties.contains(key)
||
key.startsWith(CamelConnectorConfig.CAMEL_CONNECTOR_IDEMPOTENCY_KAFKA_CLIENT_PREFIX))
{
return key + "=xxxxxxx";
}
diff --git
a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java
b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java
index dfd4500b0e..fd79415a51 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java
@@ -19,13 +19,17 @@ package org.apache.camel.kafkaconnector.utils;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.camel.CamelContext;
import org.apache.camel.LoggingLevel;
+import org.apache.camel.kafkaconnector.CamelConnectorConfig;
import org.apache.camel.spi.EndpointUriFactory;
+import org.apache.kafka.common.config.AbstractConfig;
+import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.connect.connector.ConnectRecord;
import org.slf4j.Logger;
@@ -116,6 +120,51 @@ public final class TaskHelper {
}
}
+ /**
+ * The names of the given properties that the definition declares with the
type {@link ConfigDef.Type#PASSWORD},
+ * as the comma separated list a connector passes to its tasks under
+ * {@link CamelConnectorConfig#CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF}.
+ *
+ * @param definition the configuration definition of the connector.
+ * @param props the properties of the connector.
+ * @return the comma separated names, empty when there is none.
+ */
+ public static String passwordPropertyNames(ConfigDef definition,
Map<String, String> props) {
+ Map<String, ConfigDef.ConfigKey> keys = definition.configKeys();
+ return props.keySet().stream()
+ .filter(k -> keys.containsKey(k) && keys.get(k).type ==
ConfigDef.Type.PASSWORD)
+ .sorted()
+ .collect(Collectors.joining(","));
+ }
+
+ /**
+ * The names of the task properties whose values are passwords: the ones
the connector listed under
+ * {@link CamelConnectorConfig#CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF},
and the ones the configuration of the task
+ * declares with the type {@link ConfigDef.Type#PASSWORD}. The list of the
connector is removed from the properties,
+ * as it is not a Camel property.
+ *
+ * @param config the configuration of the task.
+ * @param props the properties of the task, the list of the connector is
removed from them.
+ * @return the names of the password properties.
+ */
+ public static Set<String> takePasswordPropertyNames(AbstractConfig config,
Map<String, String> props) {
+ Set<String> names = new HashSet<>();
+ String listed =
props.remove(CamelConnectorConfig.CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF);
+ if (listed != null) {
+ for (String name : listed.split(",")) {
+ if (!name.isBlank()) {
+ names.add(name.trim());
+ }
+ }
+ }
+ for (String name : props.keySet()) {
+ if (config.typeOf(name) == ConfigDef.Type.PASSWORD) {
+ names.add(name);
+ }
+ }
+ return names;
+ }
+
private static Boolean stringStartWithOneOfPrefixes(String s, Set<String>
prefixes) {
if (s == null || prefixes == null) {
return false;
diff --git
a/core/src/test/java/org/apache/camel/kafkaconnector/utils/StartupPropertiesLoggingTest.java
b/core/src/test/java/org/apache/camel/kafkaconnector/utils/StartupPropertiesLoggingTest.java
index 9f689feb42..9ad4de9405 100644
---
a/core/src/test/java/org/apache/camel/kafkaconnector/utils/StartupPropertiesLoggingTest.java
+++
b/core/src/test/java/org/apache/camel/kafkaconnector/utils/StartupPropertiesLoggingTest.java
@@ -27,9 +27,13 @@ import java.util.Map;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.kafkaconnector.CamelConnectorConfig;
+import org.apache.camel.kafkaconnector.CamelSinkConnector;
+import org.apache.camel.kafkaconnector.CamelSinkConnectorConfig;
import org.apache.camel.kafkaconnector.CamelSinkTask;
+import org.apache.camel.kafkaconnector.CamelSourceConnector;
import org.apache.camel.kafkaconnector.CamelSourceConnectorConfig;
import org.apache.camel.kafkaconnector.CamelSourceTask;
+import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.connect.errors.ConnectException;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
@@ -44,6 +48,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -62,6 +67,12 @@ public class StartupPropertiesLoggingTest {
private static final String TRUSTSTORE_PASSWORD = "trustSt0reSecret";
private static final String PRIVATE_KEY_BODY =
"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7";
private static final String CUSTOM_OPTION_VALUE = "cust0mL0ginSecret";
+ // options a connector defines with the type PASSWORD, under names that
are not sensitive keys for Camel
+ private static final String PASSPHRASE_OPTION =
"camel.kamelet.sftp-source.privateKeyPassphrase";
+ private static final String PASSPHRASE_VALUE = "pr1vateKeyPassphr4se";
+ private static final String CLIENT_SECRET_OPTION =
"camel.kamelet.http-secured-sink.oauth2ClientSecret";
+ private static final String CLIENT_SECRET_VALUE =
"oauth2Cl1entS3cretValue";
+ private static final String HOST_OPTION =
"camel.kamelet.sftp-source.connectionHost";
private CapturingAppender appender;
private LoggerConfig loggerConfig;
@@ -91,6 +102,10 @@ public class StartupPropertiesLoggingTest {
.withProperties(props)
.build(new DefaultCamelContext());
+ return startupLogLine();
+ }
+
+ private String startupLogLine() {
return appender.messages.stream()
.filter(m -> m.startsWith("Setting initial properties"))
.findFirst()
@@ -209,6 +224,110 @@ public class StartupPropertiesLoggingTest {
}
}
+ @Test
+ public void testPasswordPropertiesAreNotLoggedInClearText() {
+ Map<String, String> props = new HashMap<>();
+ props.put(PASSPHRASE_OPTION, PASSPHRASE_VALUE);
+ props.put(HOST_OPTION, "sftp.example.com");
+
+ CamelKafkaConnectMain.builder("direct://start", "log://test")
+ .withProperties(props)
+ .withPasswordProperties(List.of(PASSPHRASE_OPTION))
+ .build(new DefaultCamelContext());
+ String logged = startupLogLine();
+
+ assertFalse(logged.contains(PASSPHRASE_VALUE), "a password property
must not reach the log: " + logged);
+ assertTrue(logged.contains(PASSPHRASE_OPTION + "=xxxxxxx"),
+ "the key should stay visible, to show the property was picked
up: " + logged);
+ assertTrue(logged.contains("sftp.example.com"), "ordinary
configuration should remain visible: " + logged);
+ }
+
+ @Test
+ public void
testPasswordOptionsOfTheSourceConnectorAreNotLoggedInClearText() {
+ CamelSourceConnector connector = new CamelSourceConnector() {
+ @Override
+ public ConfigDef config() {
+ return new ConfigDef(CamelSourceConnectorConfig.conf())
+ .define(PASSPHRASE_OPTION, ConfigDef.Type.PASSWORD, null,
ConfigDef.Importance.MEDIUM, "passphrase")
+ .define(HOST_OPTION, ConfigDef.Type.STRING, null,
ConfigDef.Importance.HIGH, "host");
+ }
+ };
+ Map<String, String> props = new HashMap<>();
+ props.put(CamelSourceConnectorConfig.TOPIC_CONF, "my-topic");
+ props.put(CamelSourceConnectorConfig.CAMEL_SOURCE_URL_CONF,
"direct:start");
+ props.put(PASSPHRASE_OPTION, PASSPHRASE_VALUE);
+ props.put(HOST_OPTION, "sftp.example.com");
+ connector.start(props);
+ Map<String, String> taskProps = connector.taskConfigs(1).get(0);
+ assertEquals(PASSPHRASE_OPTION,
taskProps.get(CamelConnectorConfig.CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF),
+ "the connector tells its tasks which of its options are
passwords");
+
+ CamelSourceTask task = new CamelSourceTask();
+ try {
+ task.start(taskProps);
+ } finally {
+ task.stop();
+ }
+ String logged = startupLogLine();
+
+ assertFalse(logged.contains(PASSPHRASE_VALUE), "a password option must
not reach the log: " + logged);
+ assertTrue(logged.contains(PASSPHRASE_OPTION + "=xxxxxxx"), logged);
+ assertTrue(logged.contains("sftp.example.com"), "ordinary
configuration should remain visible: " + logged);
+
assertFalse(logged.contains(CamelConnectorConfig.CAMEL_CONNECTOR_PASSWORD_PROPERTIES_CONF),
+ "the list of the password options is not a Camel property: " +
logged);
+ }
+
+ @Test
+ public void testPasswordOptionsOfTheSinkConnectorAreNotLoggedInClearText()
{
+ CamelSinkConnector connector = new CamelSinkConnector() {
+ @Override
+ public ConfigDef config() {
+ return new ConfigDef(CamelSinkConnectorConfig.conf())
+ .define(CLIENT_SECRET_OPTION, ConfigDef.Type.PASSWORD,
null, ConfigDef.Importance.MEDIUM, "client secret");
+ }
+ };
+ Map<String, String> props = new HashMap<>();
+ props.put(CamelSinkConnectorConfig.CAMEL_SINK_URL_CONF, "log:test");
+ props.put(CLIENT_SECRET_OPTION, CLIENT_SECRET_VALUE);
+ connector.start(props);
+ Map<String, String> taskProps = connector.taskConfigs(1).get(0);
+
+ CamelSinkTask task = new CamelSinkTask();
+ try {
+ task.start(taskProps);
+ } finally {
+ task.stop();
+ }
+ String logged = startupLogLine();
+
+ assertFalse(logged.contains(CLIENT_SECRET_VALUE), "a password option
must not reach the log: " + logged);
+ assertTrue(logged.contains(CLIENT_SECRET_OPTION + "=xxxxxxx"), logged);
+ }
+
+ @Test
+ public void
testPasswordOptionsOfTheTaskConfigurationAreNotLoggedInClearText() {
+ // a task with its own configuration class, as the syslog connector has
+ CamelSinkTask task = new CamelSinkTask() {
+ @Override
+ protected CamelSinkConnectorConfig
getCamelSinkConnectorConfig(Map<String, String> props) {
+ return new CamelSinkConnectorConfig(new
ConfigDef(CamelSinkConnectorConfig.conf())
+ .define(CLIENT_SECRET_OPTION, ConfigDef.Type.PASSWORD,
null, ConfigDef.Importance.MEDIUM, "client secret"),
+ props);
+ }
+ };
+ Map<String, String> props = new HashMap<>();
+ props.put(CamelSinkConnectorConfig.CAMEL_SINK_URL_CONF, "log:test");
+ props.put(CLIENT_SECRET_OPTION, CLIENT_SECRET_VALUE);
+ try {
+ task.start(props);
+ } finally {
+ task.stop();
+ }
+ String logged = startupLogLine();
+
+ assertFalse(logged.contains(CLIENT_SECRET_VALUE), "a password option
must not reach the log: " + logged);
+ }
+
@Test
public void testNonSensitiveValuesAreStillLogged() {
Map<String, String> props = new HashMap<>();
diff --git a/docs/modules/ROOT/pages/security-model.adoc
b/docs/modules/ROOT/pages/security-model.adoc
index 8626b6ab40..bc241b25ec 100644
--- a/docs/modules/ROOT/pages/security-model.adoc
+++ b/docs/modules/ROOT/pages/security-model.adoc
@@ -210,9 +210,10 @@ in-scope triage is whether CKC's default mapping is itself
the exposure.
CKC code that writes connector-configuration secrets to a log, an event, or a
produced Kafka record. CKC masks keys flagged sensitive by Camel's
-`SensitiveUtils` in its one startup "initial properties" log line; a path that
-bypasses that masking, or that leaks a secret value through a record or SMT,
-is in scope.
+`SensitiveUtils`, and the options the connector defines with the Kafka
+`ConfigDef.Type.PASSWORD` type, in its one startup "initial properties" log
+line; a path that bypasses that masking, or that leaks a secret value through
+a record or SMT, is in scope.
==== Deserialization or external-resource parsing added by the glue
@@ -297,9 +298,10 @@ through the normal release and upgrade-note channel.
permissive setting carries that setting. The fix for such a case lands in
Apache Camel or the Kamelets catalog and is consumed by CKC on the next
dependency bump; it is not separately re-mediated in CKC.
-* *Secrets live in the connector configuration.* CKC masks sensitive keys only
- in its own startup log line. Everything else about secret handling - the
- config topic, the REST API, externalisation - is Kafka Connect's model.
+* *Secrets live in the connector configuration.* CKC masks sensitive keys and
+ `PASSWORD` type options only in its own startup log line. Everything else
+ about secret handling - the config topic, the REST API, externalisation - is
+ Kafka Connect's model.
== Deployment hardening