CalvinKirs opened a new pull request, #71221:
URL: https://github.com/apache/doris/pull/71221

   ### Background
   
   Doris uses the JDBC URL supplied in CREATE CATALOG to configure the 
connector and, when enabled, test connectivity. Connector/J reads options from 
both the query string and host definitions.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Bugfix
   
   Problem Summary:
   
   The FE had no policy for the MySQL connection options supplied during JDBC 
catalog creation. Apply the operator's restrictions before the JDBC connector 
receives the URL. The same prepared URL is passed to the connector and 
persisted for the new catalog.
   
   ### Details
   
   - **Change map:** 226 added production lines and 168 added test lines. The 
production changes cover Connector/J option parsing, FE configuration, and the 
CREATE hook. Tests cover URL forms, configuration loading, and catalog routing.
   - **Frequency:** Applies whenever CREATE CATALOG for JDBC supplies a MySQL 
URL with a restricted option.
   - **Root cause:** CatalogFactory passes catalog properties to the JDBC 
connector, whose URL normalizer handles driver compatibility options without 
applying an FE-configured restriction list.
   - **Why existing tests missed it:** CatalogFactoryPluginRoutingTest checks 
connector selection and create-time storage context. The JDBC 
connection-validation regression suite checks connectivity. The tests did not 
cover an FE policy for URL options.
   - **Fix:** Resolve the effective jdbc_url using the JDBC connector's alias 
precedence. Check query and host options before constructing the connector and 
explicitly disable LOCAL INFILE when the option is restricted and the canonical 
setting is absent.
   - **Other paths and branches:** The new connection-option policy applies to 
JDBC catalog creation on master. ALTER, edit-log replay, and Iceberg and Paimon 
metastore JDBC settings retain their existing behavior. Release branches are 
outside the PR scope.
   - **Configs and defaults:** Set the comma-separated 
jdbc_mysql_restricted_url_parameters list in fe.conf and restart the FE. It 
defaults to allowLoadLocalInfile, allowUrlInLocalInfile, and 
allowLoadLocalInfileInPath. The two built-in flags accept disabled values, the 
path accepts an empty value, and additional listed names are blocked.
   - **Behavior change:** CREATE CATALOG rejects restricted MySQL options 
before the JDBC plugin receives the URL. Other JDBC URL options keep their 
existing handling.
   
   ### Testing
   
   - On master, Maven ran JdbcDriverUrlSecurityTest, 
JdbcCatalogUrlSecurityTest, and ConfigTest. All 35 tests passed. Checkstyle 
passed for the changed FE files.
   - The FE unit-test runner stopped before running 
CatalogFactoryPluginRoutingTest because the dev environment lacks the 
third-party protoc binary.
   
   ### Release note
   
   New MySQL-backed JDBC catalogs enforce the FE's LOCAL INFILE policy. 
Operators can set the full list of restricted MySQL JDBC URL options in fe.conf.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes (add the setting to the JDBC Catalog and 
FE configuration reference)
   - Pre-submission status: Partially verified: the FE core routing tests 
require the third-party build tools.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex
   - Generated: Code, tests, and PR description
   - Human review: not stated
   


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