Skip to content

[2.1] Fixes #28299: mask plain text secrets left in service version history (#37975) - #38185

Merged
Khairajani merged 5 commits into
2.1from
bp-37975-2.1
Nov 19, 2026
Merged

Khairajani merged 5 commits into
2.1from
bp-37975-2.1

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #28299

[2.1] backport of #37975 and the version-history part of #38117 (was #38187).

🤖 Generated with Claude Code


Summary by Gitar

  • Secret masking step:
    • Added ServiceVersionSecretsMasking to mask plain text secrets in service and Test Connection workflow version history
    • Added ServiceSecretPaths listing secret fields for each service connection type
  • Migrations:
    • Wired the masking step into the MySQL and Postgres v209 migrations via runOnce, and re-ran it in v210 migrations
  • Tests:
    • Added ServiceVersionSecretsMaskingTest covering MySQL and Postgres masking and idempotency

This will update automatically on new commits.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the existing non-blocking concern about large version histories.

Findings

  1. P2 History reads grow without bounds. ▶

Summary

This PR masks plain-text secrets in saved service and Test Connection versions on MySQL and PostgreSQL.

  • Old service and Test Connection versions replace listed plain-text secrets with masks.

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

…#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)
@Khairajani
Khairajani requested a review from a team as a code owner November 19, 2026 08:08
@Khairajani
Khairajani requested review from yan-3005 and removed request for a team November 19, 2026 08:08
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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.

Comment on lines +107 to +112
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();

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.

P2 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!

@gitar-bot

gitar-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

The 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.

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 merged commit 6c32c9d into 2.1 Nov 19, 2026
48 of 50 checks passed
@Khairajani
Khairajani deleted the bp-37975-2.1 branch November 19, 2026 13:40
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.

2 participants