Repository navigation
[2.0] Fixes #28299: encrypt the connection secrets that are still saved in plain text - #38118
Conversation
- SSIS: type databaseConnection through the MSSQL converter, so its sslConfig and authType are typed and encrypted. - Qlik Sense certificates: its oneOf branches were inline definitions, which jsonschema2pojo generates no class for; move them to their own schema files (titles unchanged) and register a converter. - 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.
❌ 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 |
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.
Backport of the secrets part of #33477: the masker and the secrets manager now walk lists, so mcpConnection.servers[].apiKey is masked and encrypted, and awsSessionToken, Fivetran apiKey and GCP privateKeyId are password fields; the ingestion code that reads them unwraps the SecretStr.
Both sat below a oneOf whose branches had no generated class, so they were saved in plain text and returned unmasked to editors. - dataStorageConfig moves out of connectionBasicType.json into its own schema; the converter factory wraps every connection that carries a sampleDataStorageConfig so its config, and the S3 credentials in it, are typed after the connection's own converter runs. - Delta Lake's metastore connection branches move to deltalake/metastore/*.json and get a converter. configSource tries StorageConfig first: both accept a connection, but only StorageConfig rejects the other kind. - The ingestion code imports the moved classes from their new modules. - KNOWN_UNCONVERTIBLE is now empty. - The new Qlik Sense and SAP S/4HANA schema files use draft-07, like 2.0.
…split rule # Conflicts: # openmetadata-service/src/test/java/org/openmetadata/service/secrets/converter/NestedSecretConverterCoverageTest.java
| */ | ||
| prefix?: string; | ||
| storageConfig?: AwsCredentials; | ||
| [property: string]: any; |
There was a problem hiding this comment.
New interfaces use forbidden types. The added index signature uses
any, contrary to the repository directive “NEVER use any type” and its instruction to use unknown for unknown values. The same pattern appears in the new Qlik certificate interfaces. Update the generated output and its source so regeneration keeps the required types.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| @Getter private static final Map<Class<?>, ClassConverter> converterMap; | ||
|
|
||
| private static final Map<Class<?>, Boolean> SAMPLE_DATA_HOLDERS = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
New cache has no limit.
SAMPLE_DATA_HOLDERS caches results in a bare ConcurrentHashMap. The repository requires every cache to have an explicit size cap. Use a bounded cache or remove this cache.
Context Used: CLAUDE.md (source)
| PASSWORD_MASK.equals(value) | ||
| ? passwordsMap.getOrDefault(fieldKey, PASSWORD_MASK) |
There was a problem hiding this comment.
On 2.0 this now masks MCP servers[].apiKey, and on save each masked value is matched to its stored secret by server name. When no stored secret matches, getOrDefault keeps *********, and that is saved as the key.
How to hit it, with the key left masked in the form each time:
- rename a server
- delete one of two servers with the same name
- add a second server with a name that already exists
Impact: the save succeeds, and the connector then sends ********* to the MCP server and fails to authenticate. Before this PR the key came back in plain text, so a save never lost it.
On main, PR #37565 covers this case: it rejects a masked value with no stored secret, and it requires unique server names. That PR is not on 2.0.
| boolean usable = name != null && occurrences.get(name) == 1; | ||
| keys.add(usable ? name : POSITION_KEY_PREFIX + index); |
There was a problem hiding this comment.
A position key (#<index>) can equal a real server name. With server names ["#1", "dup", "dup"] the keys are #1, #1, #2. The first two collide, which the comment on line 34 says cannot happen.
Impact: after a save with masked values, server #1 ends up with the first dup server's key, and its own key is lost.
| "oneOf": [ | ||
| { | ||
| "$ref": "#/definitions/sapS4HanaBasicAuthType" | ||
| "$ref": "sapS4Hana/basicAuth.json" |
There was a problem hiding this comment.
Moving these branches changes the generated Python modules. Collate's 2.0 branch still imports SapS4HanaBasicAuthType and SapS4HanaOAuthType from sapS4HanaConnection (ingestion-extension/.../saps4hana/client.py, lines 27 and 29). So once this merges, the SAP S/4HANA connector on Collate 2.0 fails at import. PR #8684 makes that change on main only, and there is no 2.0 version yet.
(cherry picked from commit 80cd51f)
…#37565) * fix(mcp): validate MCP service server names and masked values on save An MCP service's servers are matched to their stored settings by name. Require server names to be unique, and refuse a masked value that has no stored value under the same server (e.g. after a rename), so the caller is asked to enter it again instead of the placeholder being kept. * fix(mcp): check server names whenever a service's servers change The unique-name check now runs when the servers list differs from the stored one in anything but the keys, order included, not only when the names change. A service saved with repeated server names keeps saving edits outside its servers. (cherry picked from commit 58f1774)
… a secret id (cherry picked from commit b7cf316)
| String serviceId = softDeletedServiceWithPlainPassword(ns); | ||
| String workflowId = softDeletedWorkflowWithPlainPassword(ns); |
There was a problem hiding this comment.
Unchanged locals lack required final. The new test declares
serviceId and workflowId without final, although neither is reassigned. The repository requires final on locals and parameters that do not change. The same pattern appears in the new elementKeys() helper and elsewhere in the added code.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
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.
| "type": "string", | ||
| "format": "password" |
There was a problem hiding this comment.
On main, #33477 was followed by #33889, which made privateKeyId a plain string again: it is not a secret (Google shows key IDs to anyone with read-only Viewer access; the secret is privateKey, which is already encrypted), and as a password field it also has to be stored in the secrets manager when ingestion runs on a Hybrid Runner.
This backport brings #33477 without #33889. So 2.0.9 would save privateKeyId encrypted, and after the upgrade 2.1 would not decrypt it. I ran the 2.1.0-rc2 server code on a BigQuery connection saved this way: privateKey comes back decrypted, but privateKeyId stays fernet:..., both in the config sent to ingestion and in the API response.
Suggestion: including #33889 in the backport keeps 2.0 in line with main:
| "type": "string", | |
| "format": "password" | |
| "type": "string" |
| "type": gcp_values.type, | ||
| "project_id": project_id, | ||
| "private_key_id": gcp_values.privateKeyId, | ||
| "private_key_id": gcp_values.privateKeyId.get_secret_value() if gcp_values.privateKeyId else None, |
There was a problem hiding this comment.
The ingestion side of #33889, so privateKeyId is read as a plain string, like main:
| "private_key_id": gcp_values.privateKeyId.get_secret_value() if gcp_values.privateKeyId else None, | |
| "private_key_id": gcp_values.privateKeyId, |
| from metadata.generated.schema.entity.services.connections.dataStorageConfig import ( | ||
| DataStorageConfig, | ||
| ) |
There was a problem hiding this comment.
py-checkstyle fails on this import order (ruff I001). Moving this dataStorageConfig import below the database.datalakeConnection one, or running make py_format, fixes it; the rest of the tree then passes.
* Revert privateKeyId from password format back to plain string an identifier, not a secret; restore it to a plain string in the spec, the generated UI schemas, and build_google_credentials_dict. * Update generated TypeScript types and dereferenced schemas --------- Co-authored-by: Rohit Jain <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…d or moved A save kept an existing secret reference, so a renamed MCP server still read its old name's secret and a server later added under that name overwrote it. Before a list is written, a reference to another element's secret is read back into its value and stored under the element's own id. A reference that cannot be read is kept.
A move read every source first, which protects a save that succeeds; one that failed part way could leave a server reading another's key. The value at the element's own id is now read as well and written back if the save fails, and a refused value is rejected before any key moves.
This reverts commit 69e14b9.
…s renamed or moved" This reverts commit 08529fa.
Code Review ✅ Approved 🔴 High risk 3 closed / 3 findingsThe secrets migration re-encrypts credentials across services and workflows, changing stored-data protection; incorrect conversion could expose secrets or break credential access. Encrypts and masks connection secrets still stored in plain text, including SSIS database connections, Qlik Sense and SAP S/4HANA oneOf branches, MCP server API keys, and sample-data storage configs. Renaming a collection element no longer drops its masked secret, names differing only by case get distinct secret ids, and restoring a newly created moved secret no longer blocks Azure retries. No open issues found. ✅ 3 closed✅ Edge Case: Renaming a collection element drops its masked secret
✅ Bug: Names differing only by case share one external secret id
✅ Bug: Restoring a newly created moved secret by deleting it blocks Azure retries
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 #28299
[2.0]backport of #38117, #37565 (and #38190, now part of #38117), follow-up to #37962.Changes
databaseConnectiongoes through the MSSQL converter, so itssslConfigandauthTypeare encrypted and masked.certificatesand SAP S/4HANAauthType: theoneOfbranches move to their own schema files (titles unchanged) and get converters. The Python clients import the new modules; Collate's SAP S/4HANA connector needs the matching import change on 2.0.servers[].apiKeyis masked and encrypted, andawsSessionTokenand FivetranapiKeybecome password fields. GCPprivateKeyIdstays a plain string: Revert privateKeyId from password format back to plain string #33889 is included, as on main.*********as the key. Server names must be unique.Prodandprodget distinct secrets.dataStorageConfigmoves to its own schema file, and every database connection'ssampleDataStorageConfigis converted, so its S3 keys are encrypted.migrate: re-encrypts stored workflows (Test Connection requests), and soft-deleted services and workflows.ADR:2026-11-19-secret-bearing-oneof-branches-live-in-their-own-schema-files.Tests
org.openmetadata.service.secretstests pass, plusReflectionUtilCollectionKeysTest.McpServiceResourceITpasses, including the rename and duplicate name cases.SecretsManagerUpdateSoftDeletedITchecks that a soft-deleted service and workflow holding a plain text password are stored encrypted after the update.origin/2.0.End-to-end test: 2.0.7 upgraded to this branch (MySQL, ES 9.3)
migrateexited 0 with no failed updates. Only the OpenMetadata service'ssecurityConfig.jwtTokenis left in plain text, by design (DO_NOT_ENCRYPT_CLASSES).🤖 Generated with Claude Code
The latest changes introduce no new blocking behavior, but earlier repository-rule findings still need to be addressed before merging.
Findings
Summary
This PR expands encryption and masking for connection secrets, including nested settings and MCP server lists.
migrateupdates stored workflows and soft-deleted records too.Reviews (18) · Last reviewed commit: "Five parameters at most in the masker wa..." · Reviewed by Greptile