hello-stephen commented on code in PR #71221:
URL: https://github.com/apache/doris/pull/71221#discussion_r4751573304
##########
fe/fe-foundation/src/main/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurity.java:
##########
@@ -60,6 +67,32 @@ public final class JdbcDriverUrlSecurity {
// This intentionally forbids any path separator, so it can never escape
the drivers directory.
private static final Pattern SAFE_DRIVER_FILE_NAME =
Pattern.compile("^[A-Za-z0-9._-]+\\.jar$");
+ private static final String MYSQL_PREFIX = "jdbc:mysql";
+ private static final Pattern MYSQL_URL = Pattern.compile(
+
"jdbc:mysql[\\w+:%]*\\s*(?://(?<authority>[^/?#]*))?(?:/[^?#]*)?(?:\\?(?<query>[^#]*))?",
+ Pattern.CASE_INSENSITIVE);
+ private static final Pattern HOST_PROPERTY_GROUP =
Pattern.compile("\\(([^()]*)\\)");
Review Comment:
[P2] Preserve quoted values in legacy host properties
With Connector/J 5.1.49,
`jdbc:mysql://address=(host=db.example)(password='p(a)ss')/app` is valid:
[expandHostKeyValues](https://github.com/mysql/mysql-connector-j/blob/5.1.49/src/com/mysql/jdbc/NonRegisteringDriver.java#L763-L797)
splits outside quotes and removes the enclosing quotes. This pattern instead
matches the inner `(a)`, leaving `(password='p` for `checkHostPropertySyntax`,
which throws before the connector is created. Doris still tests this driver in
`test_mysql_timestamp_utc_transport.groovy`, so existing connection settings
with such passwords can no longer be used to create a catalog. The same missing
quotation handling also rejects safely disabled
`(allowLoadLocalInfile="false")` in `isAllowedValue`. Please preserve legacy
quotation semantics when tokenizing and validating host values, and add
coverage for these safe forms.
--
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]