Skip to content

Fixes #28299: encrypt the connection secrets that are still saved in plain text - #38117

Merged
Khairajani merged 13 commits into
mainfrom
secrets-remaining-converters
Nov 19, 2026
Merged

Khairajani merged 13 commits into
mainfrom
secrets-remaining-converters

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #28299

Follow-up to #33193 and #37965, from the review of #37975. Some connection secrets are still saved in plain text on main, so migrate can't encrypt them and #37975 only masks their old copies.

Changes

  • SSIS: databaseConnection is a typed MssqlConnection, but the SSIS converter never passed it through the MSSQL converter. Its sslConfig (and authType) stayed untyped.
  • Qlik Sense certificates, NATS authType and SAP S/4HANA authType: their oneOf branches were inline #/definitions, which jsonschema2pojo generates no class for. They move to their own schema files with titles unchanged (the same fix Fixes #28299: mask and encrypt secrets nested in a schema oneOf #33193 made for SFTP), and get registered converters. The Python connectors import the new modules; the TypeScript and public JSONs are regenerated.
  • Workflows on migrate: migrate now re-encrypts stored workflows (Test Connection requests) the way it does services. The updateWorkflow that existed was never called, and it saved through the ingestion pipeline DAO.
  • Soft-deleted rows: migrate now also re-encrypts soft-deleted services and workflows, which it skipped before.
  • Decision record: ADR:2026-11-19-secret-bearing-oneof-branches-live-in-their-own-schema-files records the split rule and the Collate merge order.
  • Coverage test: it now also checks a typed connection property whose own oneOf holds secrets, which is how SSIS slipped through.
  • Allowlist: KNOWN_UNCONVERTIBLE is now empty.
  • List secrets (from Fixes #28299: keep secret keys of list elements distinct #38190): masked secrets of list elements, such as MCP servers, are matched back by exact name, so reordering or deleting servers never swaps keys. External secret ids fall back to position when two names clean to the same id (Prod/prod). The v3 amendment to ADR:2026-11-11-mcp-service-server-names-are-unique-and-masks-need-a-stored-value records both rules.
  • Version history (from Fixes #28299: mask service version secrets from 2.1.0 too #38187): the Fixes #28299: mask plain text secrets left in service version history #37975 masking step also runs from 2.1.0, because a database that ran a 2.1 RC skips 2.0.9 data steps. It now masks plain secret: values too, since the database secrets manager reads them as a password.
  • Merge order: Collate's SAP S/4HANA connector imports the moved classes. open-metadata/openmetadata-collate#8684 switches its imports and must merge right after this PR.

Tests

  • NestedSecretConverterCoverageTest failed first on SSIS, Qlik Sense, NATS and SAP S/4HANA.
  • New PasswordEntityMaskerTest cases cover SSIS, Qlik Sense, NATS and SAP S/4HANA.
  • All 423 org.openmetadata.service.secrets tests pass.
  • SecretsManagerUpdateSoftDeletedIT soft-deletes a service and a Test Connection workflow with a plain text password, runs the update, and checks both are stored encrypted. It fails without the fix.
  • NATS and Qlik Sense Python unit tests: 123 pass.
  • New ReflectionUtilCollectionKeysTest and PasswordEntityMaskerTest cases cover reordered, deleted and case-only server names.
  • ServiceVersionSecretsMaskingTest covers a secret: value; an upgrade 2.0.7 → 2.1 RC → this branch masked the history the 2.1 RC had skipped.

End-to-end test: 2.0.7 upgraded to this branch plus #37975 (MySQL, ES 9.3)

  • On 2.0.7, seeded 248 services from 2.0.7's own schemas: one per secret-bearing oneOf branch of every connector, with a unique marker in each of 632 secret fields. Each was saved 3 times, along with a Test Connection workflow.
  • Before the upgrade, plain text markers sat in 264 current service fields and 264 current workflow fields.
  • migrate exited 0.
  • After the upgrade, before the SAP S/4HANA commit, 3 plain text fields were left in current services and 3 in workflows. Two were the SAP S/4HANA fields, which that commit's masker test now covers. The third is the OpenMetadata service's securityConfig.jwtToken, which is on DO_NOT_ENCRYPT_CLASSES by design.
  • Two stale MicrosoftFabric Test Connection workflows could not be re-saved because they hold a field main has removed. This is logged and migrate carries on.
  • The ingestion bot reads every secret of all 248 services back with its original value, except two kinds the 2.1.0 migrations remove on purpose:
    • sampleDataStorageConfig (37)
    • Delta Lake (2)
  • The admin saw every secret masked except SAP S/4HANA, which the later commit fixes.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge with the documented Collate update coordinated.

Summary

This PR closes gaps in connection-secret encryption and masking, including stored workflows, soft-deleted records, and version history.

  • Nested connector credentials now reach the secrets conversion path.
  • Migrations refresh saved workflows and deleted service records.
  • Saved connection versions mask more secrets and cover 2.1.0 upgrades.
  • List secrets stay matched to their named items as lists change.

Khairajani acknowledges the SAP Python import change and requires Collate #8684 to merge immediately after this PR.

Reviews (10) · Last reviewed commit: "Name boolean locals as questions in vers..." · Reviewed by Greptile

- SSIS: type databaseConnection through the MSSQL converter, so its sslConfig
  and authType are typed and encrypted.
- Qlik Sense certificates and NATS authType: their oneOf branches were inline
  definitions, which jsonschema2pojo generates no class for; move them to their
  own schema files (titles unchanged) and register converters.
- migrate now re-encrypts stored workflows (Test Connection requests) the way
  it does services; the unused updateWorkflow also saved through the wrong DAO.
- The coverage test also checks typed connection properties whose own oneOf
  holds secrets, which is how SSIS slipped through.
Its oneOf branches were inline definitions with no generated class; move them
to dashboard/sapS4Hana/{basicAuth,oAuthCredentials}.json (titles and javaTypes
unchanged) and register a converter. KNOWN_UNCONVERTIBLE is now empty.

The generated Python classes move with them: Collate's SAP S/4HANA connector
imports them, so it needs the matching import change.
A position id moved when servers were reordered, so replacing or clearing one key wrote over, or deleted, the secret the other server still referenced. Such names now get an id from a hash of the exact name.
@gitar-bot

gitar-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 3 closed / 3 findings

The migration rewrites stored service and workflow secrets and masks history; mistakes could make credentials inaccessible or irreversibly lose historical values.

Encrypts remaining connection secrets by moving SSIS sslConfig, Qlik Sense certificates, NATS authType and SAP S/4HANA authType into typed converters, re-encrypts stored workflows and soft-deleted rows on migrate, and masks service history secrets. Resolved the missing ADR for splitting secret oneOf branches, the untested soft-deleted re-encryption path, and the SAP S/4HANA class move that Collate imports. No open issues found.

✅ 3 closed
✅ Quality: Rule to split secret oneOf branches into schema files is not recorded

📄 openmetadata-service/src/test/java/org/openmetadata/service/secrets/converter/NestedSecretConverterCoverageTest.java:39-44 📄 openmetadata-spec/src/main/resources/json/schema/entity/services/connections/dashboard/qlikSense/certificatePath.json:1-15 📄 openmetadata-service/src/main/java/org/openmetadata/service/secrets/converter/ClassConverterFactory.java:243-257 📄 ingestion/src/metadata/ingestion/source/messaging/nats/connection.py:29-37
This is the third PR on this trade-off (#33193 SFTP, #37965, and this one). It sets a rule that only exists in the PR description and in a test comment: "their oneOf branches were inline #/definitions, which jsonschema2pojo generates no class for. They move to their own schema files with titles unchanged... and get registered converters." Nothing in docs/decisions/ records it. The split also changes a contract with other repositories. The generated Python names natsConnection.BasicAuth/TokenAuth/NkeyAuth and qlikSenseConnection.QlikCertificatePath/QlikCertificateValues are gone, and the description itself says Collate imports these generated modules (the reason SAP S/4HANA is held back). Because the repo squash-merges, this reasoning won't reach git log. The record would say: "A oneOf branch that holds a format: password field lives in its own schema file with a javaType, and its parent connection registers a converter in ClassConverterFactory that lists every branch class. NestedSecretConverterCoverageTest.KNOWN_UNCONVERTIBLE may only shrink. Moving a branch changes the generated Python module path, so a matching Collate change merges with it."

✅ Quality: Soft-deleted re-encryption in migrate has no test that fails without it

📄 openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerUpdateService.java:225 📄 openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerUpdateService.java:266-267 📄 openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerUpdateService.java:438-439 📄 openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerUpdateService.java:466-467
This commit makes migrate re-encrypt soft-deleted services and workflows. It does that by switching retrieveServices, retrieveWorkflows, updateService and updateWorkflow to Include.ALL. No test covers this path: the only test that touches SecretsManagerUpdateService is SecretsManagerUpdateExtensionTest, and it only exercises extension loading. If any of the four Include.ALL arguments went back to the default, soft-deleted rows would keep plain-text secrets and nothing would fail. AGENTS.md asks that a bug fix come with a test that fails without it. Add an IT that soft-deletes a service and a workflow holding a secret, runs updateEntities(), and checks the stored JSON is encrypted.

✅ Bug: SAP S/4HANA authType split moves generated classes Collate imports

📄 openmetadata-spec/src/main/resources/json/schema/entity/services/connections/dashboard/sapS4HanaConnection.json:30-40 📄 openmetadata-spec/src/main/resources/json/schema/entity/services/connections/dashboard/sapS4Hana/basicAuth.json:1-7 📄 openmetadata-spec/src/main/resources/json/schema/entity/services/connections/dashboard/sapS4Hana/oAuthCredentials.json:1-7 📄 openmetadata-service/src/main/java/org/openmetadata/service/secrets/converter/ClassConverterFactory.java:315-319
This commit moves sapS4HanaBasicAuthType and sapS4HanaOAuthCredentialsType out of sapS4HanaConnection.json#/definitions and into new files, sapS4Hana/basicAuth.json and sapS4Hana/oAuthCredentials.json. javaType keeps the Java class names the same. The generated Pydantic module and class names do change, though: the classes now come from ...dashboard.sapS4Hana.basicAuth / .oAuthCredentials and take their names from the new titles, so they no longer live in sapS4HanaConnection. The PR description says this split was deliberately left out because "Collate's connector imports its generated classes and splitting it would need a matching Collate change". Nothing in this repo imports them, so the break shows up downstream: once this merges, the Collate SAP S/4HANA connector fails at import time. The tree also has no record of a merge order, unlike the SSIS case in ADR:2026-11-02-ssis-package-storage-accepts-adls-and-oss-merges-before-collate. One fix is to land a matching Collate PR and add a record saying "SAP S/4HANA authType branches live in sapS4Hana/basicAuth.json and sapS4Hana/oAuthCredentials.json; the Collate connector updates its imports in the same release, and OSS merges first." Also update the PR description, which still says authType stays allowlisted. The other fix is to revert this commit and keep the allowlist entry.

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

@Khairajani
Khairajani enabled auto-merge (squash) November 19, 2026 13:23
@Khairajani
Khairajani merged commit 65b6fab into main Nov 19, 2026
63 checks passed
@Khairajani
Khairajani deleted the secrets-remaining-converters branch November 19, 2026 13:26
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.

Sftp Service connection details contain unmasked password

3 participants