Skip to content

Fixes #28299: mask plain text secrets left in service version history - #37975

Merged
Khairajani merged 8 commits into
mainfrom
mask-service-version-secrets
Nov 19, 2026
Merged

Khairajani merged 8 commits into
mainfrom
mask-service-version-secrets

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #28299

Released versions (1.11 to 2.0.8) saved many connection secrets in plain text, mostly the ones below a oneOf the secrets code could not type. migrate re-encrypts the current service rows, but the copies in the version history stay plain text. This PR masks them.

Changes

  • New 2.0.9 data step, ServiceVersionSecretsMasking, for MySQL and Postgres, run once through runOnce. It goes in 2.0.9 so it can be cherry-picked to 2.0 unchanged; 2.1 gets it with its next rebase on main.
  • It uses its own handle and a fixed list of secret paths (ServiceSecretPaths). There are no repositories or converters.
  • The list holds every format: password path of every service connection, across the schemas of all releases from 1.11.0 to 2.0.8 plus main's: 460 paths over 139 connection types. It keeps fields main has since dropped, such as sampleDataStorageConfig, and Delta Lake.
  • Paths are grouped by service entity type and keyed on the config's own type, since VertexAI has different paths under LLM and ML model services. A path can cross an array ([], the MCP servers) or a map whose every value is a secret ({}, Kafka consumerConfig).
  • It reads only version rows: one key query on the extension prefixes of the 13 service types and workflow (Test Connection requests), then each row by primary key.
  • It masks a listed value only while it is plain text. fernet: values, secret: references and masked values stay as they are, so running it again changes nothing.

Unit test

  • ServiceVersionSecretsMaskingTest runs on real MySQL and Postgres (Testcontainers).
  • Cases:
    • every original path
    • encrypted values, references and empty values
    • unlisted fields and non-version rows
    • Kafka map values and MCP array elements
    • VertexAI under LLM vs ML model services
    • a Test Connection workflow version
    • a second run

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

  • On 2.0.7, seeded 248 services built 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. 2.0.7 accepted all 248.
  • Before the upgrade, plain text markers sat in 264 current service fields, 264 current workflow fields and 528 version fields.
  • migrate from this branch exited 0 and logged Masked plain text secrets in 210 of 490 versions.
  • After the upgrade, 0 markers are left in any version row.
  • Some current rows still hold plain text. That is outside this step and is handled in a follow-up converter PR:
    • 12 current service fields, all in converters that still don't encrypt: Qlik Sense certificates.sslConfig, SAP S/4HANA authType, SSIS databaseConnection.sslConfig, and the OpenMetadata service's securityConfig.jwtToken
    • current Test Connection workflow rows, which migrate does not re-save

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge.

Summary

Adds a one-time migration that masks plain text secrets in saved service and Test Connection versions on MySQL and PostgreSQL.

  • Service history hides plain-text connection secrets.

No new actionable issues found. Tests were inspected but not run.

Reviews (6) · Last reviewed commit: "Skip workflow versions that are not Test..." · Reviewed by Greptile

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.
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.
@Khairajani
Khairajani requested a review from a team as a code owner November 17, 2026 11:37
@Khairajani
Khairajani requested review from manerow and removed request for a team November 17, 2026 11:37
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

Choosing None for an optional oneOf (e.g. the Alation database connection)
submits {}, which converted to the first candidate class filled with schema
defaults.
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.
@Khairajani
Khairajani force-pushed the mask-service-version-secrets branch from 39bc710 to 91df73f Compare November 17, 2026 12:10
Base automatically changed from secrets-oneof-coverage-main to main November 17, 2026 12:37
@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 18, 2026
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 ({}).
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.
@gitar-bot

gitar-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

The migration overwrites plaintext secrets in persisted version history across 13 service types, permanently removing those historical credential values.

Adds a one-time 2.0.9 migration step, ServiceVersionSecretsMasking, that masks plain-text connection secrets left in service version history for MySQL and Postgres. No open 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 31575e1 into main Nov 19, 2026
55 checks passed
@Khairajani
Khairajani deleted the mask-service-version-secrets branch November 19, 2026 07:58
Khairajani added a commit that referenced this pull request Nov 19, 2026
…istory (#37975) (#38185)

* Fixes #28299: mask plain text secrets left in service version history (#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)

* Mask service version secrets from 2.1.0 too, including secret: values

(cherry picked from commit a1cbc7f)

* Use final locals and smaller test helpers

* Use final in the version masking test

* Name boolean locals as questions in version masking
Khairajani added a commit that referenced this pull request Nov 19, 2026
…istory (#37975) (#38184)

* Fixes #28299: mask plain text secrets left in service version history (#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)

* Mask service version secrets from 2.1.0 too, including secret: values

(cherry picked from commit a1cbc7f)

* Drop the 2.1.0 note from the 2.0 masking step

* Use final locals and smaller test helpers

* Use final in the version masking test

* Name boolean locals as questions in version masking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sftp Service connection details contain unmasked password

2 participants