Repository navigation
[2.1] Fixes #28299: mask plain text secrets left in service version history (#37975) - #38185
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 |
| private static List<VersionKey> readVersionKeys(Handle handle) { | ||
| Query query = handle.createQuery(KEYS_SQL); | ||
| VERSIONED_TYPES.forEach(type -> query.bind(type, type + VERSION_INFIX + "%")); | ||
| return query | ||
| .map((rs, ctx) -> new VersionKey(rs.getString("id"), rs.getString("extension"))) | ||
| .list(); |
There was a problem hiding this comment.
History reads grow without bounds.
readVersionKeys() loads every matching service and workflow version into memory, then maskVersion() makes a separate database read for each one—even workflows without connection secrets. Large histories therefore add one database round trip per row and keep every key in memory throughout the upgrade.
Read bounded batches containing id, extension, and json, as the nearby ConnectionSecretsEncryptionMigration does. This removes the extra read per row and keeps memory use bounded.
Knowledge Base Used: Roll back version history pagination and its large-table migration
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 riskThe migration rewrites service and Test Connection history across databases, irreversibly replacing stored secret values and changing persisted historical records. Adds a migration step that masks plain text secrets in service and Test Connection version history, wired into the MySQL and Postgres v209 migrations and backported to 2.1 with its own masking test coverage. 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 #28299
[2.1]backport of #37975 and the version-history part of #38117 (was #38187).secret:values are masked.ServiceVersionSecretsMaskingTest(MySQL and Postgres) andMigrationCodeFingerprintTestpass.🤖 Generated with Claude Code
Summary by Gitar
ServiceVersionSecretsMaskingto mask plain text secrets in service and Test Connection workflow version historyServiceSecretPathslisting secret fields for each service connection typev209migrations viarunOnce, and re-ran it inv210migrationsServiceVersionSecretsMaskingTestcovering MySQL and Postgres masking and idempotencyThis will update automatically on new commits.


Confidence Score: 5/5
The PR appears safe to merge, with the existing non-blocking concern about large version histories.Findings
Summary
This PR masks plain-text secrets in saved service and Test Connection versions on MySQL and PostgreSQL.
Reviews (5) · Last reviewed commit: "Name boolean locals as questions in vers..." · Reviewed by Greptile