geyanggang commented on code in PR #14963:
URL: https://github.com/apache/gravitino/pull/14963#discussion_r4562006154


##########
docs/kafka-catalog.md:
##########
@@ -20,8 +20,17 @@ Besides the [common catalog 
properties](./gravitino-server-config.md#catalog-pro
 | Property Name       | Description                                            
                                                                                
                                                                       | 
Default Value | Required |
 
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------|
 | `bootstrap.servers` | The Kafka broker(s) to connect to, allowing for 
multiple brokers by comma-separating them.                                      
                                                                              | 
(none)        | Yes      |
-| `gravitino.bypass.` | Property name with this prefix passed down to the 
underlying Kafka Admin client for use. (refer to [Kafka Admin 
Configs](https://kafka.apache.org/34/documentation.html#adminclientconfigs) for 
more details) | (none)        | No       |
-
+| `gravitino.bypass.` | Property name with this prefix passed down to the 
underlying Kafka Admin client for use. (refer to [Kafka Admin 
Configs](https://kafka.apache.org/39/documentation.html#adminclientconfigs) for 
more details) | (none)        | No       |
+
+The Kafka catalog does not accept the Kafka config provider properties 
`gravitino.bypass.config.providers`
+and `gravitino.bypass.config.providers.*` (for example 
`gravitino.bypass.config.providers.file.class`).
+They would let a catalog resolve `${env:...}`, `${file:...}`, or 
`${directory:...}` references from the
+Gravitino server's own environment and files. A catalog that sets them, 
whether in the create-catalog
+request or in `catalogs/kafka/conf/kafka.conf`, fails to connect and 
`testConnection` returns an
+error naming the rejected properties. Put the literal value in the catalog 
property instead.

Review Comment:
   Agreed, and I confirmed the exposure is real since the REST API returns 
bypass properties unmasked. `docs/kafka-catalog.md` and the migration guide now 
limit the literal-value advice to non-sensitive settings, warn against 
plaintext credentials such as `gravitino.bypass.sasl.jaas.config`, and point to 
`CatalogChange.setSecretBinding` when a secret provider is configured.



##########
docs/migration-guide.md:
##########
@@ -28,6 +28,26 @@ existing deployments. For database backup, schema scripts, 
and rollback commands
   whole Kubernetes pod CIDR, lets those clients choose the recorded address 
again. See
   [HTTP Server](./gravitino-server-config.md#http-server).
 
+### Kafka catalog client upgrade
+- The Kafka catalog now ships the Kafka client 3.9.2 instead of 3.4.0. The 
`gravitino.bypass.`
+  properties are passed to this client, so check them against the
+  [Kafka Admin 
Configs](https://kafka.apache.org/39/documentation.html#adminclientconfigs).
+- The Kafka catalog rejects `gravitino.bypass.config.providers` and 
`gravitino.bypass.config.providers.*`
+  (for example `.class` and `.param.*`), including when they come from
+  `catalogs/kafka/conf/kafka.conf`. Kafka 3.9 adds an environment variable 
provider, and any
+  provider can read the Gravitino server's own environment or files. A catalog 
that still sets
+  them fails on schema and topic operations and on `testConnection`, with an 
error that names the
+  rejected properties. In 1.3, the file and directory providers could be used 
this way.
+- Before upgrading, find Kafka catalogs and `kafka.conf` entries that use 
these properties or
+  `${file:...}`, `${directory:...}`, or `${env:...}` references. Remove the 
provider properties and
+  set the resolved value directly, for example with `alterCatalog`. Direct 
values in
+  `gravitino.bypass.` properties can be returned in plaintext by the REST API, 
see
+  [Catalog properties](./gravitino-server-config.md#catalog-properties).
+- The Kafka 3.9 client rejects `com.sun.security.auth.module.JndiLoginModule` 
and
+  `com.sun.security.auth.module.LdapLoginModule` in `sasl.jaas.config` by 
default. Catalogs that

Review Comment:
   Good catch, I had only covered catalog properties. The upgrade check now 
also covers the `KafkaClient` entry in the file named by 
`java.security.auth.login.config`, which a catalog without `sasl.jaas.config` 
falls back to. I also checked the 3.4.0 jar: it blocks only `JndiLoginModule` 
by default, so the guide now says `LdapLoginModule` is the new rejection and 
`JndiLoginModule` was already rejected.



##########
docs/migration-guide.md:
##########
@@ -28,6 +28,26 @@ existing deployments. For database backup, schema scripts, 
and rollback commands
   whole Kubernetes pod CIDR, lets those clients choose the recorded address 
again. See
   [HTTP Server](./gravitino-server-config.md#http-server).
 
+### Kafka catalog client upgrade
+- The Kafka catalog now ships the Kafka client 3.9.2 instead of 3.4.0. The 
`gravitino.bypass.`
+  properties are passed to this client, so check them against the
+  [Kafka Admin 
Configs](https://kafka.apache.org/39/documentation.html#adminclientconfigs).
+- The Kafka catalog rejects `gravitino.bypass.config.providers` and 
`gravitino.bypass.config.providers.*`
+  (for example `.class` and `.param.*`), including when they come from
+  `catalogs/kafka/conf/kafka.conf`. Kafka 3.9 adds an environment variable 
provider, and any
+  provider can read the Gravitino server's own environment or files. A catalog 
that still sets
+  them fails on schema and topic operations and on `testConnection`, with an 
error that names the
+  rejected properties. In 1.3, the file and directory providers could be used 
this way.
+- Before upgrading, find Kafka catalogs and `kafka.conf` entries that use 
these properties or
+  `${file:...}`, `${directory:...}`, or `${env:...}` references. Remove the 
provider properties and
+  set the resolved value directly, for example with `alterCatalog`. Direct 
values in
+  `gravitino.bypass.` properties can be returned in plaintext by the REST API, 
see
+  [Catalog properties](./gravitino-server-config.md#catalog-properties).
+- The Kafka 3.9 client rejects `com.sun.security.auth.module.JndiLoginModule` 
and
+  `com.sun.security.auth.module.LdapLoginModule` in `sasl.jaas.config` by 
default. Catalogs that
+  use either module fail to connect after the upgrade. Switch to another login 
module. If you
+  cannot, set the JVM system property 
`org.apache.kafka.disallowed.login.modules` on the Gravitino
+  server to the modules you still want to block; see the Kafka documentation 
for its semantics.

Review Comment:
   Agreed. I removed the override as a migration step. The guide now says not 
to re-enable it, because the property replaces the default blocklist for every 
Kafka catalog in the JVM and lets anyone who can supply Kafka JAAS settings 
select the module.



##########
NOTICE.bin:
##########
@@ -34,7 +34,7 @@ Apache Iceberg
 Copyright 2017-2026 The Apache Software Foundation
 
 Apache Kafka
-Copyright 2011-2023 The Apache Software Foundation
+Copyright 2026 The Apache Software Foundation

Review Comment:
   Yes, it is copied from the jar. `unzip -p kafka-clients-3.9.2.jar NOTICE` 
prints `Apache Kafka` and `Copyright 2026 The Apache Software Foundation.`, and 
that is exactly the line in `NOTICE.bin`. The year is what the 3.9.2 artifact 
ships (the 3.4.0 jar says 2023), not the current date. The previous `2011-2023` 
text in the repo did not match either jar.



##########
catalogs/catalog-kafka/src/test/java/org/apache/gravitino/catalog/kafka/TestKafkaCatalogOperations.java:
##########
@@ -317,6 +318,79 @@ public void testInitialization() throws IOException {
     Assertions.assertEquals(DEFAULT_SCHEMA_NAME, schema.name());
   }
 
+  @Test
+  public void testInitializeRejectsConfigProviders() {
+    CatalogEntity catalogEntity =
+        CatalogEntity.builder()
+            .withId(idGenerator.nextId())
+            .withName("test_kafka_catalog_config_providers")
+            .withNamespace(Namespace.of(METALAKE_NAME))
+            .withType(MESSAGING)
+            .withProvider("kafka")
+            .withAuditInfo(
+                AuditInfo.builder()
+                    .withCreator("testKafkaUser")
+                    .withCreateTime(Instant.now())
+                    .build())
+            .withProperties(MOCK_CATALOG_PROPERTIES)
+            .build();
+
+    for (String key :
+        ImmutableList.of(
+            "config.providers",
+            "config.providers.env.class",
+            "config.providers.env.param.allowlist.pattern")) {
+      Map<String, String> properties =
+          ImmutableMap.<String, String>builder()
+              .putAll(MOCK_CATALOG_PROPERTIES)
+              .put("gravitino.bypass." + key, "env")
+              .put("gravitino.bypass.request.timeout.ms", "${env:PATH}")
+              .build();
+      KafkaCatalogOperations ops = new KafkaCatalogOperations(store, 
idGenerator);
+      IllegalArgumentException exception =
+          Assertions.assertThrows(
+              IllegalArgumentException.class,
+              () ->
+                  ops.initialize(
+                      properties, catalogEntity.toCatalogInfo(), 
KAFKA_PROPERTIES_METADATA));
+      Assertions.assertTrue(
+          exception.getMessage().contains("gravitino.bypass." + key), 
exception.getMessage());
+      // The AdminClient must not be created, and no placeholder may be 
resolved or echoed.
+      Assertions.assertNull(ops.adminClientConfig.get("request.timeout.ms"));
+      
Assertions.assertFalse(exception.getMessage().contains(System.getenv("PATH")));

Review Comment:
   Fixed. The test now uses a fixed placeholder 
(`${env:GRAVITINO_KAFKA_TEST_ENV_MARKER}`) and no longer reads `PATH`, so it 
does not depend on the environment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to