hello-stephen commented on code in PR #71089:
URL: https://github.com/apache/doris/pull/71089#discussion_r4734283163


##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveConnectorProvider.java:
##########
@@ -85,12 +85,13 @@ public void validatePropertiesForUpdate(
 
     @Override
     public ConnectorSecuritySurface securitySurface() {
-        // Every key the HMS client may take its thrift endpoint from: 
hive.metastore.uris, its documented alias
+        // Every key the HMS client may take its endpoint from: 
hive.metastore.uris, its documented alias
         // uri, and Hive 3's metastore.thrift.uris, which the client reads 
first. The engine's SSRF gate rejects
-        // an intranet target there at CREATE / ALTER CATALOG. The secrets are 
the metastore's sensitive
-        // properties (none today: a keytab is named by its path).
+        // an intranet target there at CREATE / ALTER CATALOG, including both 
DLF endpoint spellings.
+        // Credential aliases come from the metastore binder; keytab paths are 
not secret values.
         return 
ConnectorSecuritySurface.ofSsrfEndpoints(HiveCatalogProperties.HIVE_METASTORE_URIS,
-                HiveCatalogProperties.URI, 
HiveCatalogProperties.METASTORE_THRIFT_URIS)
+                HiveCatalogProperties.URI, 
HiveCatalogProperties.METASTORE_THRIFT_URIS,
+                "dlf.endpoint", "dlf.catalog.endpoint")

Review Comment:
   [P1] Probe bare DLF endpoints at their implicit HTTPS port
   
   With `security_checker_class_name` configured, a catalog can supply 
`dlf.endpoint=127.0.0.1` (plus valid DLF credentials and explicit OSS storage 
settings), but neither CREATE nor ALTER probes that destination. 
`PluginDrivenExternalCatalog.parseEndpoint` returns null for a scheme-less host 
without a port, and `checkEndpointsAgainstSsrf` silently skips it, while the 
DLF SDK connects over HTTPS. Registering these keys therefore leaves the normal 
DLF endpoint spelling outside the installed operator policy. Normalize the 
endpoint with its default port before checking it, and cover both aliases 
through the actual catalog gate.



##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveConnector.java:
##########
@@ -706,6 +709,10 @@ static HadoopAuthenticator 
buildPluginAuthenticator(Map<String, String> properti
         ClassLoader previous = Thread.currentThread().getContextClassLoader();
         try {
             
Thread.currentThread().setContextClassLoader(HiveConnector.class.getClassLoader());
+            // DLF signs its metadata API requests; storage Kerberos 
credentials must not trigger an HMS login.
+            if (HmsClientConfig.isDlfMetastore(properties)) {

Review Comment:
   [P2] Preserve HMS authentication for accepted DLF proxy modes
   
   With `hive.metastore.type=dlf`, `dlf.proxy.mode=METASTORE_ONLY`, a secure 
HMS URI and explicit HMS client principal/keytab, this early return suppresses 
the configured HMS login. The binder accepts and forwards that mode unchanged, 
and the [vendor 
proxy](https://raw.githubusercontent.com/aliyun/datalake-catalog-metastore-client/master/metastore-client-hive/metastore-client-hive3/src/main/java/com/aliyun/datalake/metastore/hive2/ProxyMetaStoreClient.java)
 constructs a Hive Thrift client for it and hybrid modes. `createClient` then 
uses `Callable::call`, leaving the transport without the configured UGI 
credentials, so connectivity checking or the first metadata access fails. 
Restrict this bypass to DLF-only operation or reject unsupported proxy modes 
during validation; apply the same correction to Hudi's parallel branch.



##########
fe/fe-connector/fe-connector-metastore-spi/src/main/java/org/apache/doris/connector/metastore/spi/AbstractDlfMetaStoreProperties.java:
##########
@@ -45,7 +45,7 @@ public abstract class AbstractDlfMetaStoreProperties extends 
AbstractMetaStorePr
             description = "DLF session/security token.")
     private String sessionToken = "";
 
-    @ConnectorProperty(names = {"dlf.region"}, required = false,
+    @ConnectorProperty(names = {"dlf.region", "dlf.catalog.region"}, required 
= false,

Review Comment:
   [P2] Carry the canonical DLF region through storage binding
   
   A catalog using `hive.metastore.type=dlf`, `dlf.catalog.region=cn-hangzhou` 
and canonical DLF credentials, with no explicit endpoint, passes the new 
metastore validation but still fails CREATE with "Region is not set". 
`PluginDrivenExternalCatalog.validateStorageProperties` passes the original map 
to the filesystem plugin manager, which selects OSS for a DLF catalog; 
`OssFileSystemProperties` recognizes `dlf.region` but omits this new alias, so 
it cannot derive a storage endpoint. Propagate the alias to OSS/OSS-HDFS 
binding or supply a canonical storage view, and test the full CREATE/ALTER path 
rather than only the metastore holder.



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