github-actions[bot] commented on code in PR #70965:
URL: https://github.com/apache/doris/pull/70965#discussion_r4689335698


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/IcebergRestProperties.java:
##########
@@ -347,6 +363,8 @@ private void addAuthenticationProperties() {
         Security security = 
Security.valueOf(icebergRestSecurityType.toUpperCase());
         if (security == Security.OAUTH2) {
             addOAuth2Properties();
+        } else if (security == Security.GOOGLE) {
+            icebergRestCatalogProperties.put(AuthProperties.AUTH_TYPE, 
AuthProperties.AUTH_MANAGER_IMPL_GOOGLE);

Review Comment:
   [P1] Mask inline Google credentials. The newly enabled GoogleAuthManager 
accepts `gcp.auth.credentials-json`, and `initializeCatalog()` forwards that 
raw catalog property to it, so users can configure the complete service-account 
JSON (including `private_key`) here. This key is absent from 
`PrintableMap.SENSITIVE_KEY` and from the sensitive connector-property 
annotations. Consequently CREATE CATALOG audit SQL and SHOW CREATE CATALOG 
print the private key verbatim; the latter only requires the catalog SHOW check 
(which includes SELECT privilege). Register native Google credential 
properties, including this JSON and `gcs.oauth2.token`, as sensitive and cover 
both audit and SHOW CREATE masking.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/AbstractIcebergProperties.java:
##########
@@ -234,6 +237,16 @@ public void toFileIOProperties(List<StorageProperties> 
storagePropertiesList,
                 fileIOProperties.put(AwsClientProperties.CLIENT_REGION, 
region);
             }
         }
+        if (IcebergExternalCatalog.ICEBERG_REST.equals(getIcebergCatalogType())

Review Comment:
   [P2] Preserve generic GCS routing in non-REST catalogs. The new 
`iceberg-gcp` dependency affects every FE catalog, but this guard only protects 
REST. For example, a JDBC Iceberg catalog with 
`io-impl=org.apache.iceberg.io.ResolvingFileIO`, a `gs://` warehouse and 
`gs.access_key`/`gs.secret_key` previously fell back to HadoopFileIO and used 
its configured HMAC identity. `IcebergJdbcMetaStoreProperties.initCatalog()` 
still honors that explicit resolver, but the newly available GCSFileIO now 
initializes successfully and later uses ADC, ignoring Hadoop HMAC. Existing 
catalogs therefore stop reading metadata (or use another identity). Preserve 
this routing for supported explicit generic resolvers in the non-REST paths 
too, including the HMS path that bypasses this method.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/IcebergRestProperties.java:
##########
@@ -347,6 +363,8 @@ private void addAuthenticationProperties() {
         Security security = 
Security.valueOf(icebergRestSecurityType.toUpperCase());
         if (security == Security.OAUTH2) {
             addOAuth2Properties();
+        } else if (security == Security.GOOGLE) {

Review Comment:
   [P1] Validate catalog-supplied Google credential configurations. This 
enables GoogleAuthManager for raw catalog properties, including 
`gcp.auth.credentials-json`, which it passes to 
`GoogleCredentials.fromStream()` without restricting credential types or nested 
sources. In the bundled auth library, an `external_account` configuration can 
name any FE-readable `credential_source.file` and any HTTPS `token_url`. On the 
first catalog initialization, `GoogleAuthSession.authenticate()` refreshes the 
credential: the file supplier reads the file and the STS handler POSTs its 
contents as `subject_token` to that URL, before a successful REST response is 
needed. Catalog CREATE permission therefore becomes a local-file disclosure 
capability. Validate/restrict user-supplied credential types, file sources and 
endpoints before delegating to this manager, or require operator-controlled 
credential configuration.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/AbstractIcebergProperties.java:
##########
@@ -234,6 +237,16 @@ public void toFileIOProperties(List<StorageProperties> 
storagePropertiesList,
                 fileIOProperties.put(AwsClientProperties.CLIENT_REGION, 
region);
             }
         }
+        if (IcebergExternalCatalog.ICEBERG_REST.equals(getIcebergCatalogType())
+                && 
!Boolean.parseBoolean(origProps.get("iceberg.rest.vended-credentials-enabled"))
+                && (s3Target instanceof GCSProperties
+                        || origProps.keySet().stream().anyMatch(key -> 
key.startsWith("fs.gs.")))) {

Review Comment:
   [P2] Detect GCS routing from the effective Hadoop configuration. Supported 
Hadoop settings can come from `hadoop.config.resources`, but those entries are 
merged into `conf` without being added to `origProps`. A REST catalog using 
`fs.hdfs.support=true` and an XML resource containing 
`fs.gs.impl=org.apache.hadoop.fs.s3a.S3AFileSystem` plus its HMAC settings has 
neither a GCSProperties target nor a raw `fs.gs.*` key. This condition 
therefore leaves the default resolver unchanged; adding `iceberg-gcp` switches 
its metadata reads from the configured Hadoop identity to ADC. Include the 
merged configuration when deciding whether to preserve Hadoop GCS access, and 
cover a resource-loaded configuration.



##########
fe/be-java-extensions/iceberg-metadata-scanner/pom.xml:
##########
@@ -35,6 +35,34 @@ under the License.
     </properties>
 
     <dependencies>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.doris</groupId>
+            <artifactId>fe-iceberg-common</artifactId>

Review Comment:
   [P1] Package the FileIO closure with parent-loaded Iceberg. Standard BE 
startup puts the preload assembly on the application classpath; its 
`s3-tables-catalog-for-iceberg` dependency already brings in `iceberg-core`. 
`JniScannerClassLoader` delegates to that parent, so `SerializationUtil` is 
parent-loaded while this new resolver and GCSFileIO exist only in the scanner 
child. Its plain ObjectInputStream resolves classes with the parent loader, 
causing `$files` tasks containing `NativeGcsResolvingFileIO` (and native GCS 
tasks) to fail with ClassNotFoundException before `open()`. A context-aware 
deserializer alone also leaves the package-private routing override ineffective 
across defining loaders. Put these classes and Iceberg core in the same 
defining loader in the deployed BE, and cover the actual preload-plus-child 
topology; the flat unit-test/isolated-jar classpath misses this.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/AbstractIcebergProperties.java:
##########
@@ -234,6 +237,16 @@ public void toFileIOProperties(List<StorageProperties> 
storagePropertiesList,
                 fileIOProperties.put(AwsClientProperties.CLIENT_REGION, 
region);
             }
         }
+        if (IcebergExternalCatalog.ICEBERG_REST.equals(getIcebergCatalogType())
+                && 
!Boolean.parseBoolean(origProps.get("iceberg.rest.vended-credentials-enabled"))

Review Comment:
   [P2] Use the normalized credential-vending flag. The existing property 
binder trims String values, so `iceberg.rest.vended-credentials-enabled=" true 
"` enables vending in `isIcebergRestVendedCredentialsEnabled()` and sends the 
delegation header. This new raw-map check instead returns false. With a raw 
`fs.gs.*` setting and default/generic FileIO, it therefore installs 
`NativeGcsResolvingFileIO`, which routes `gs://` through Hadoop and ignores the 
server's `gcs.oauth2.token`; reads fail or use local credentials. Read the 
normalized flag (or normalize identically) so the two decisions agree.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to