CalvinKirs commented on code in PR #65987:
URL: https://github.com/apache/doris/pull/65987#discussion_r3649459181


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java:
##########
@@ -304,28 +307,111 @@ public static String getFullDriverUrl(String driverUrl) 
throws IllegalArgumentEx
                     + "file://xxx.jar, http://xxx.jar, https://xxx.jar, or 
xxx.jar (without prefix).");
         }
 
+        URI uri;
         try {
-            URI uri = new URI(driverUrl);
-            String schema = uri.getScheme();
-            checkCloudWhiteList(driverUrl);
-            if (schema == null && !driverUrl.startsWith("/")) {
-                return checkAndReturnDefaultDriverUrl(driverUrl);
-            }
+            uri = new URI(driverUrl);
+        } catch (URISyntaxException e) {
+            // Fail closed: an unparsable URL must never be silently accepted, 
otherwise the
+            // allowed-path check below could be bypassed by a malformed URL.
+            LOG.warn("invalid jdbc driver url: {}", driverUrl, e);
+            throw new IllegalArgumentException("Invalid driver URL: " + 
driverUrl);
+        }
+
+        String schema = uri.getScheme();
+        checkCloudWhiteList(driverUrl);
+        if (schema == null && !driverUrl.startsWith("/")) {
+            return checkAndReturnDefaultDriverUrl(driverUrl);

Review Comment:
   We deliberately reverted enforcement in the shared resolver in acf842e830.
   
   Enforcing the grammar inside `getFullDriverUrl` also affects unmodified 
historical catalogs: Iceberg/Paimon/legacy JDBC consumers call it lazily with 
no create/alter/replay context, so a stricter resolver could break an existing 
catalog on first access after upgrade. Guaranteeing zero impact to existing 
catalogs is the priority here, so the mandatory grammar lives only on the 
create/alter path.
   
   The accepted trade-off: a *new* non-jdbc-catalog metastore `driver_url` that 
bypasses the JDBC connector is not grammar-checked at the resolver. 
jdbc-catalog CREATE/ALTER remains fully validated.



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