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


##########
fe/fe-connector/fe-connector-adbc/src/main/java/org/apache/doris/connector/adbc/AdbcDriverInfo.java:
##########
@@ -0,0 +1,76 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.connector.adbc;
+
+import org.apache.doris.connector.spi.DorisConnectorException;
+
+import org.apache.arrow.adbc.core.AdbcConnection;
+import org.apache.arrow.adbc.core.AdbcException;
+import org.apache.arrow.adbc.core.AdbcInfoCode;
+import org.apache.arrow.adbc.core.AdbcStatusCode;
+import org.apache.arrow.vector.VectorSchemaRoot;
+import org.apache.arrow.vector.ipc.ArrowReader;
+
+import java.util.Locale;
+
+/** Verifies the native Flight driver's server-info isolation before it can 
mutate vendor state. */
+final class AdbcDriverInfo {
+    // Private local GetInfo capability, advertised by the bundled ADBC source 
patch; never sent to a server.
+    private static final int CONNECTION_SCOPED_VENDOR_INFO = 0x444f0001;
+
+    private AdbcDriverInfo() {
+    }
+
+    static void requireIsolatedVendorInfo(AdbcConnection connection) throws 
Exception {
+        Object name;
+        try {
+            name = readInfo(connection, AdbcInfoCode.DRIVER_NAME.getValue());
+        } catch (AdbcException e) {
+            if (e.getStatus() != AdbcStatusCode.NOT_IMPLEMENTED && 
e.getStatus() != AdbcStatusCode.NOT_FOUND) {
+                throw e;
+            }
+            return;

Review Comment:
   [P1] Fail closed when Flight driver identity is unavailable before probing 
vendor info
   
   `requireIsolatedVendorInfo` returns at line 47 when `getInfo(DRIVER_NAME)` 
is NOT_IMPLEMENTED/NOT_FOUND, so `readVendorName` immediately requests 
`VENDOR_NAME` without ever checking the private 0x444f0001 isolation 
capability. Because ADBC catalogs accept operator-supplied local libraries, an 
older/custom Flight driver that omits DRIVER_NAME can still expose the 
process-wide DriverInfo map and reintroduce the concurrent reader/writer crash 
or cross-server vendor leakage this PR is meant to prevent. Probe the private 
capability before allowing any vendor request (or reject an ambiguous driver), 
and add the missing-driver-name case to the guard tests.



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