Repository navigation
[2.0] Fixes #28299: mask plain text secrets left in service version history (#37975) - #38184
Conversation
…#37975) * Fixes #28299: mask secrets nested below every oneOf branch The coverage test from #33193 converted only the first secret-bearing branch of each oneOf and only checked that the property itself was no longer a Map, so a secret in a later branch, or a oneOf nested inside a typed value, passed unnoticed. Checking every branch through a walk that mirrors the password walkers finds three secrets still returned unmasked: - PowerBI GCS pbitFilesSource: securityConfig.gcpConfig.privateKey - Superset API connection: sslConfig certificates and key - MySQL GCP CloudSQL authType: password and gcpConfig.privateKey convertProperty now sets a property through its getter's type, so a typed property such as GCPCredentials can be run through its own converter, and the registry gains converters for GcpCloudSqlConfig, the PowerBI GCSConfig and SupersetApiConnection. MySQL's authType candidates include CloudSQL. * test: assert each nested secret field is masked, not just absent A converter that dropped a nested secret would have passed the previous check, which only looked for the original value and any mask in the JSON. * Keep an empty oneOf object as it is instead of converting it Choosing None for an optional oneOf (e.g. the Alation database connection) submits {}, which converted to the first candidate class filled with schema defaults. * Mask plain text connection secrets left in service version history Secrets below some oneOf branches (Databricks Pipeline auth, PowerBI GCS key, Superset SSL and Cloud SQL, MySQL Cloud SQL) were saved without encryption. migrate re-saves current services with the fixed converters; this 2.0.9 data step masks the plain text copies kept in entity_extension version rows. * test: cover the Superset Cloud SQL secrets in the version masking step * Mask every connection secret released versions left in version history The list now covers every format:password path of every service connection in the releases from 1.11.0 to 2.0.8 and the current schemas, for all service types and for Test Connection workflow versions, keyed on the config's own type. Paths may cross arrays ([]) and maps whose every value is a secret ({}). * Skip workflow versions that are not Test Connection requests A workflow such as a query runner request has no serviceType, and looking up its secret paths with a null service entity threw out of the step. (cherry picked from commit 31575e1)
❌ 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 |
| public static void maskPlainTextSecrets(Handle handle, ConnectionType connectionType) { | ||
| List<VersionKey> keys = readVersionKeys(handle); |
There was a problem hiding this comment.
Unchanged variables lack
final. The Java guide requires final on local variables and parameters that do not change. The new helper omits it on handle, connectionType, and keys, with the same pattern elsewhere in the added code. Apply final to unchanged locals and parameters.
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!
| private static final String FERNET_PREFIX = "fernet:"; | ||
| private static final String SECRET_REFERENCE_PREFIX = "secret:"; |
There was a problem hiding this comment.
Secret prefixes are defined twice. The helper copies values already defined by
Fernet.FERNET_PREFIX and SecretsManager.SECRET_FIELD_PREFIX. The Java guide requires one definition in one location. Import the existing constants so these checks do not drift from the code that writes the values.
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!
| @Testcontainers(disabledWithoutDocker = true) | ||
| class ServiceVersionSecretsMaskingTest { |
There was a problem hiding this comment.
Tests use the wrong module. This class starts real MySQL and PostgreSQL containers, so it is an integration test.
AGENTS.md requires integration tests in openmetadata-integration-tests, but this class is added under openmetadata-service. Move it to the required module.
Context Used: AGENTS.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!
(cherry picked from commit a1cbc7f)
| final class ServiceSecretPaths { | ||
| private ServiceSecretPaths() {} | ||
|
|
||
| static final Map<String, Map<String, List<String>>> SECRET_PATHS = |
There was a problem hiding this comment.
Secret list exceeds class limit.
ServiceSecretPaths spans more than 600 lines. The Java guide says classes should stay under 500 lines. Split the fixed lists by service family and combine them here so each list is easier to review without changing the migration's saved field paths.
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!
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findingsThe 2.0.9 migration irreversibly replaces plaintext secrets across service and Test Connection history, altering persisted version data and losing those values. Adds a 2.0.9 migration step that masks plain text secrets in saved service and Test Connection version history on MySQL and Postgres, including values starting with ✅ 1 closed✅ Quality: Javadoc says the step also runs from 2.1.0; this branch has no such hook
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 #37975 and the version-history part of #38117 (was #38187).MicroStrategyChartRenamestep and runs the masking step after it, on MySQL and Postgres.secret:is masked too, since the database secrets manager reads it as part of a password.ServiceVersionSecretsMaskingTestpasses (MySQL and Postgres).migrateexited 0, both 2.0.9 steps ran, "Masked plain text secrets in 210 of 490 versions", and no plain text secret is left in any version row.🤖 Generated with Claude Code
The remaining repository requirements must be addressed before merging; no new behavior issue was found in the latest update.
Findings
Summary
This PR masks plain-text secrets in saved service and Test Connection versions during the 2.0.9 upgrade.
Reviews (6) · Last reviewed commit: "Name boolean locals as questions in vers..." · Reviewed by Greptile