Skip to content

Fixes #37552: Verify MySQL sslConfig certificates and reject invalid sslConfig - #37553

Merged
ulixius9 merged 2 commits into
mainfrom
ulixius9/pylon-issue-check
Nov 11, 2026
Merged

ulixius9 merged 2 commits into
mainfrom
ulixius9/pylon-issue-check

Conversation

@ulixius9

@ulixius9 ulixius9 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #37552

Ingestion — sslConfig certificates were never used on MySQL / Doris / StarRocks. SSLManager.setup_ssl put the temp-file paths under ssl_ca / ssl_cert / ssl_key inside the ssl connection argument. PyMySQL's ssl dict reads ca / cert / key; the prefixed names only exist as URL query params and top-level kwargs. With a CA configured, connections were encrypted but verify_mode=CERT_NONE, and client certificates were never sent. The keys are now ca / cert / key. Also corrects the RDS IAM comment in mysql/connection.py, which implied the default {"check_hostname": True} verifies the server (without a CA, PyMySQL verifies nothing).

Server — an invalid sslConfig was saved, then crashed the runner. sslConfig is a JSON Schema oneOf, so the POJO field is Object. When the converter can't type the value (e.g. {"sslMode": "require"} on MySQL), it keeps the raw map and the service is stored. The ingestion runner then fails extra_forbidden, and Test Connection dies with ~1.5k validation errors. ServiceEntityRepository.prepare now calls SecretsUtil.validateSslConfig, which returns a 400 naming the unrecognised field.

  • Scope: writes only. The converters stay lenient: they also run on decrypt/mask (GET) and in SecretsManagerUpdateService. Failing there would make already-stored services unreadable, and impossible to fix by PATCH.
  • Which connectors are checked: only those whose getSslConfig() returns Object, i.e. the verifySSLConfig oneOf. ES/OpenSearch use a typed SSLConfig and are skipped.
  • How the map is checked: it is converted to ValidateSSLClientConfig rather than rejected because it is a map. Connectors with no class converter (MongoDB, Db2, Salesforce, …) carry valid configs as maps too.

Behaviour change: a service that already has an invalid sslConfig stored gets a 400 on its next PUT/PATCH until sslConfig is fixed in that same request. GET and list are unaffected.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • MySQL/Doris/StarRocks with sslConfig.caCertificate → PyMySQL builds a CERT_REQUIRED context with hostname checking
  • Client cert/key reach PyMySQL under cert/key
  • Creating a MySQL service with sslConfig: {sslMode: require} → 400 unrecognized field 'sslMode'
  • Valid sslConfig still accepted (MySQL in the IT; a connector without a class converter, MongoDB, in the unit test)

Unit tests

  • ingestion/tests/unit/test_ssl_manager.py: runs the real pymysql.connections.Connection._create_ssl_ctx on the generated args, for all three connectors. Fails on main (6 failed), passes here.
  • ingestion/tests/unit/source/database/test_mysql_iam.py: fixture used the wrong ssl_ca key
  • openmetadata-service/.../secrets/SecretsUtilSslConfigTest.java: goes through the real SecretsUtil.convert path
  • Local: pytest tests/unit/test_ssl_manager.py tests/unit/source/database/test_mysql_iam.py → 59 passed. mvn test -pl openmetadata-service -Dtest=SecretsUtilSslConfigTest,ServiceEntitySecretsTest,ClassConverterFactoryTest → 48 passed.

Backend integration tests

  • DatabaseServiceResourceIT: post_mysqlServiceWithUnknownSslConfigField_400 and post_mysqlServiceWithValidSslConfig_200_OK. Both pass locally (mysql-elasticsearch lane), along with the existing post_databaseServiceWithMysqlConnection_200_OK.
  • Full DatabaseServiceResourceIT locally: one other failure, put_updateWithoutConnection_preservesExistingConnection_200. It also fails with this PR's Java changes reverted (same assertion), so it's unrelated.

Ingestion integration tests

  • Not applicable (unit-level fix; covered by the PyMySQL context test above)

Playwright (UI) tests

  • Not applicable (no UI changes)

Manual testing performed

End-to-end Test Connection against a TLS-only MySQL 8.0. Setup: require_secure_transport=ON, a server cert from a private CA, one user with REQUIRE SSL and one with REQUIRE X509.

The harness drives the same path as the hybrid runner: AutomationWorkflow.model_validate(raw dict), then run_workflow, with the real Mysql.testConnectionDefinition steps. Only the OM client is a mock (it receives status updates).

Case main this PR
A. sslConfig.caCertificate = correct CA Successful Successful
B. sslConfig.caCertificate = rogue CA Successful (not verified) Failed: CERTIFICATE_VERIFY_FAILED
C. X509 user, CA + sslCertificate + sslKey Failed (no client cert sent) Successful
D. X509 user, CA only Failed Failed
E. sslConfig: {sslMode: require} runner validation error runner validation error (server now rejects it at save time with a 400)
F/G. no sslConfig, connectionArguments.ssl.ca = correct / rogue CA Successful / Failed Successful / Failed

Also checked on PyMySQL 1.2.3 / 1.2.4 (2.0.x pins pymysql~=1.0): {"ssl_ca": p} and {"check_hostname": True} give CERT_NONE; {"ca": p} gives CERT_REQUIRED.

UI screen recording:

Not applicable — backend and ingestion only.

🤖 Generated with Claude Code

…sslConfig

SSLManager passed the sslConfig file paths to PyMySQL as ssl_ca/ssl_cert/ssl_key,
keys the ssl dict ignores, so MySQL, Doris and StarRocks connected over TLS
without verifying the server and without presenting client certificates. Use
PyMySQL's ca/cert/key keys.

sslConfig is a oneOf, so the converters kept any map they could not type and the
server saved configs (e.g. sslMode on MySQL) that the ingestion runner refused to
load. Reject them with a 400 on service create/update; reads stay lenient so
already-stored configs can still be fixed.
@ulixius9
ulixius9 requested review from a team as code owners November 11, 2026 10:09
@ulixius9
ulixius9 requested review from harshsoni2024 and yan-3005 and a balanced review from Copilot November 11, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 skip-pr-checks label.

Java DatabaseServiceType constants from Databricks onward carry the next
service's value on main (javaEnums is missing Clickzetta), so the SDK sends
MongoDB as SapSuccessFactors. The untyped-map case stays covered by
SecretsUtilSslConfigTest.
Copilot AI balanced review requested due to automatic review settings November 11, 2026 10:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Enabling CA-backed certificate and hostname verification for MySQL, Doris, and StarRocks could reject connections with mismatched certificates or hostnames.

Fixes MySQL, Doris, and StarRocks sslConfig handling by passing certificate paths under the ca, cert, and key keys PyMySQL expects, and rejects invalid sslConfig maps on service writes with a 400 naming the unrecognised field. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@ulixius9
ulixius9 merged commit f28197e into main Nov 11, 2026
67 of 69 checks passed
@ulixius9
ulixius9 deleted the ulixius9/pylon-issue-check branch November 11, 2026 12:20
ayush-shah added a commit to zerafachris/OpenMetadata that referenced this pull request Nov 12, 2026
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.
ulixius9 added a commit that referenced this pull request Nov 12, 2026
…sslConfig (#37553) (#37633)

* Fixes #37552: Verify MySQL sslConfig certificates and reject invalid sslConfig

SSLManager passed the sslConfig file paths to PyMySQL as ssl_ca/ssl_cert/ssl_key,
keys the ssl dict ignores, so MySQL, Doris and StarRocks connected over TLS
without verifying the server and without presenting client certificates. Use
PyMySQL's ca/cert/key keys.

sslConfig is a oneOf, so the converters kept any map they could not type and the
server saved configs (e.g. sslMode on MySQL) that the ingestion runner refused to
load. Reject them with a 400 on service create/update; reads stay lenient so
already-stored configs can still be fixed.

* Test valid sslConfig on MySQL only in the IT

Java DatabaseServiceType constants from Databricks onward carry the next
service's value on main (javaEnums is missing Clickzetta), so the SDK sends
MongoDB as SapSuccessFactors. The untyped-map case stays covered by
SecretsUtilSslConfigTest.

(cherry picked from commit f28197e)
akashverma0786 pushed a commit that referenced this pull request Nov 17, 2026
#36946) (#37359)

* fix: use PyMySQL ssl dict keys (ca, cert, key) in SSLManager.setup_ssl (#36946)

* fix(ingestion): preserve MySQL SSL options and certificate setup

* fix(ingestion): preserve reusable SSL connection settings

* fix(ingestion): call the SecretStr class, not its Annotated alias, in setup_ssl

* fix(ingestion): build MySQL SSL setup on main's ca/cert/key fix

Main switched the PyMySQL ssl dict to ca/cert/key in #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.

---------

Co-authored-by: Ayush Shah <[email protected]>
Co-authored-by: Mayur Singal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL sslConfig certificates are ignored, and invalid sslConfig is saved by the server

3 participants