Repository navigation
fix: use PyMySQL ssl dict keys (ca, cert, key) in SSLManager.setup_ssl (#36946) - #37359
akashverma0786 merged 6 commits into
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Main switched the PyMySQL ssl dict to ca/cert/key in open-metadata#37553 and added its own tests. Take main's text unchanged so the branch merges cleanly, keep the deep copy, move the top-level SSL option folding into _nest_pymysql_ssl_options, and move the branch tests main does not cover into test_ssl_manager_pymysql.py.
Code Review ✅ Approved 🔴 High riskChanging SSL option handling for MySQL, Doris, and StarRocks could weaken certificate validation or prevent secure database connections if options are misinterpreted. Fixes MySQL, Doris, and StarRocks SSL setup by nesting top-level ssl_ca, ssl_cert, ssl_key, ssl_verify_cert, and ssl_verify_identity options into PyMySQL's ssl dict so sslConfig certificates are no longer dropped, and by deep-copying the connection config so reused overrides persist. Duplicate SSL initialization in Doris and StarRocks is removed. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |



Fixes #36946
Context
#37553 (merged to main) already switched
SSLManager.setup_sslfor MySQL, Doris and StarRocks to PyMySQL'sca/cert/keykeys inside thessldict. This PR is now built on top of that fix and covers what it leaves open. All three connectors use PyMySQL (Doris throughDorisPyMySQLDialect), so one handler covers them.What changed and why
sslConfig. When any ofssl_ca,ssl_cert,ssl_key,ssl_verify_certorssl_verify_identityis truthy inconnectionArguments, PyMySQL replaces the wholessldict with one built from those options, so thesslConfigCA and client certificate are discarded._nest_pymysql_ssl_optionsmoves them into thessldict instead (top-level values win), keeps PyMySQL's meaning ofssl_verify_cert/ssl_verify_identity, and nestsssl_key_passwordaspassword. String values are resolved throughCustomSecretStrfirst, since secrets are only resolved for top-level arguments.setup_sslworks on a deep copy.get_ssl_connection(profiler, sampler, test suite) sets up the same config object once per interface; mutating it in place would lose the top-level overrides after the first call.__init__ransetup_sslbeforeCommonDbSourceService.__init__ran it again, writing a second set of certificate temp files and orphaning the first manager's files (never cleaned up). The duplicate__init__is removed.Test evidence
pytest tests/unit/test_ssl_manager.py tests/unit/test_ssl_manager_pymysql.py tests/unit/source/database/test_mysql_iam.py: 78 passed (PyMySQL 2.2.8).test_ssl_manager_pymysql.pybuild a realpymysql.Connection(defer_connect=True)from the resulting arguments; 15 of them fail against main'sssl_manager.py/ Doris / StarRocks sources (the other 4 pin behaviour PyMySQL already had).ruff checkandruff format --check: clean.Prepared with AI assistance (OpenCode), reviewed for correctness before submission.
Summary by Gitar
ssl_ca,ssl_cert,ssl_key,ssl_verify_cert, andssl_verify_identityinto the nestedssldict inSSLManager.setup_sslssl_key_passwordbefore nesting it aspasswordmodel_copy(deep=True)so reused connection objects keep their original overridesdoris/metadata.pyandstarrocks/metadata.pyThis will update automatically on new commits.