Skip to content

Fixes 38598: Mask connection secrets nested in shared oneOf branches - #38599

Merged
sweta1308 merged 12 commits into
mainfrom
test/connection-secret-masking
Nov 25, 2026
Merged

sweta1308 merged 12 commits into
mainfrom
test/connection-secret-masking

Conversation

@sweta1308

@sweta1308 sweta1308 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38598

On a service's Connection tab, some stored secrets rendered in a readable text input instead of a password input:

Connector Field
Datalake configSource.securityConfig.awsSecretAccessKey, awsSessionToken, gcpConfig.privateKey
PowerBI pbitFilesSource.securityConfig.awsSecretAccessKey, awsSessionToken, gcpConfig.privateKey
Hive metastoreConnection.authType.gcpConfig.gcpConfig.privateKey
Superset connection.authType.gcpConfig.gcpConfig.privateKey

The read-only view (ServiceConnectionDetailsUtils) picked a oneOf branch by matching the stored value's top-level keys only. Datalake's and PowerBI's file sources have Azure, GCS and S3 branches that all declare securityConfig, and Azure comes first, so an S3 config was read through Azure's branch and its secrets lost their format: password marker. A database-only configSource handler also looked up definitions.S3Config / definitions.GCPConfig, which no connection schema has any more.

  • getSchemaProperties now scores branches against the stored value through nested keys.
  • handleDatabaseConfigSource is removed; Datalake's configSource goes through the generic path, which already follows $ref and oneOf.

The tests come from open-metadata/openmetadata-collate#3105, which asks for connection-field validation and masking coverage across connector types; the all-connectors test is what found these leaks.

Type of change:

  • Bug fix

High-level design:

  • Fix: one util, src/utils/ServiceConnectionDetailsUtils.tsx. Branch matching recurses through nested objects (bounded by the existing MAX_SCHEMA_RESOLUTION_DEPTH); the stale special case is deleted rather than repaired, because the generic path already resolves every shape it handled. Its only consumer is ServiceConnectionDetails.component.tsx.
  • Visible change: Datalake GCS used to show only the gcpConfig fields; it now also shows gcpImpersonateServiceAccount, as every other nested config is shown. Secrets stay masked either way.
  • Tests, one per layer:
    • ServiceConnectionDetails.browser.test.tsx walks every connector's schema (service-type enums × serviceUtilClassBase loaders, 11 categories), finds every format: password field through $ref, nested objects and oneOf/anyOf, renders a config holding only that secret, and asserts it never renders readable. New connectors and secret fields are covered without editing the test.
    • AddServicePage.browser.test.tsx: required-field errors and a masked secret input on the add-service form for Redshift, Postgres, Mysql, Snowflake, Tableau and Kafka. This does not exercise the fix; it is the validation coverage open-metadata/openmetadata-collate#3105 asks for.
    • EditConnectionFormPage.browser.test.tsx: the edit-connection page for a stored service served with the masked value, one connector per secret shape (Redshift authType oneOf, Snowflake flat field in a synthesized authType, Kafka top-level, Tableau non-database, Datalake shared-branch securityConfig); the secret is a password input holding *********.
    • No Playwright spec: every check above still holds with the backend mocked, and server-side masking (********* for non-bot users) is covered by PasswordEntityMaskerTest.
  • Alternative rejected: fixing the hardcoded definition paths in place. Schemas are pre-resolved, so those paths would drift again.

Tests:

Use cases covered

  • Every connector's stored secret renders as a password input on the Connection tab.
  • A Datalake S3 secret is masked on the Connection tab; the access key id stays readable.
  • Editing a saved connection keeps the stored secret masked, for five secret shapes.
  • Submitting an empty add-service form lists every required field, for six connectors across database, dashboard and messaging services.
  • The secret input on the add-service form stays a password input while typing.

Unit tests

  • I added unit tests for the new/changed logic.
  • src/utils/ServiceConnectionDetailsUtils.test.tsx: 2 new tests on the real Datalake schema (branch matching by nested keys; S3 secret masked, access key id readable). Both fail on main.
  • npx jest src/utils/ServiceConnectionDetailsUtils.test.tsx src/components/Settings/Services/ServiceConnectionDetails/ServiceConnectionDetails.test.tsx --coverage: 25/25 passed; ServiceConnectionDetailsUtils.tsx 88.77% lines, 89.1% statements. The uncovered lines are the untouched Airflow / metadata JWT / GitHub-credentials special handlers.
  • Related suites (ServiceConnectionDetails*, components/integration, ServiceDetailsPage): 23 suites, 358/358 passed.
  • Vitest browser mode:
    • ServiceConnectionDetails.browser.test.tsx: 11/11 passed. On main it fails on the 8 fields in the table above.
    • AddServicePage.browser.test.tsx: 6/6 passed. It fails (6/6) when PasswordWidget is mapped to the text widget.
    • EditConnectionFormPage.browser.test.tsx: 5/5 passed. It fails (5/5) when PasswordWidget is mapped to the text widget.

Local results on 609e3eb:

Jest: ServiceConnectionDetailsUtils.test.tsx, 15/15 passed

Vitest browser: 3 files, 22/22 passed

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • No new spec; the UI checks are browser tests (see above). .github/playwright/impact-map.json now maps ServiceConnectionDetails/** and ServiceConnectionDetailsUtils* to Flow/ServiceForm.spec.ts (Ingestion), which opens the Connection tab, so changes there no longer trigger the full suite; impact-map.generated.json regenerated (--check passes).
  • Flow/ServiceForm.spec.ts (Ingestion lane), the spec the impact map selects for the changed sources, run locally on 609e3eb against this branch's UI: 13/13 passed.

Playwright: Flow/ServiceForm.spec.ts Ingestion lane, 13/13 passed

Manual testing performed

  1. Local OpenMetadata server on :8585; this branch's UI served by Vite on :3005 proxying /api to it.
  2. Created a Datalake service through the API with an S3 configSource.securityConfig (awsAccessKeyId, awsSecretAccessKey, awsRegion).
  3. Opened it as admin → Connection tab: awsSecretAccessKey is a password input holding *********; awsAccessKeyId is readable. On main's UI the same field is type="text".
  4. Edit connection: the secret field is a password input holding *********.

(Checked with a temporary Playwright spec during development; it is not part of this PR.)

UI screen recording:

No recording (bug fix, no new UI feature). Screenshots of the changed surface: the Connection tab of a Datalake service with an S3 configSource.securityConfig, admin user, local server.

Before (main): awsSecretAccessKey renders as a readable type="text" input, and the S3 fields lose their descriptions because the view reads them through the Azure branch.

Before: Datalake S3 awsSecretAccessKey rendered as a text input

After (this PR): awsSecretAccessKey is a type="password" input; awsAccessKeyId stays readable and the S3 field descriptions are back.

After: Datalake S3 awsSecretAccessKey rendered as a password input

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema changes.
  • For a UI feature or feature task: not applicable, bug fix.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    • Reviewed aaf7b015940: no 🔴. Fixed the 🟡s from the first pass (end-to-end coverage of the changed shape, exact masked-value assertion, no issue numbers in test headers). AddServicePage.browser.test.tsx kept deliberately as the validation coverage open-metadata/openmetadata-collate#3105 asks for.
    • 5a9e387158f (review-bot suggestion): Playwright spec replaced by EditConnectionFormPage.browser.test.tsx; tests and CI test selection only, production code unchanged since the review.
  • Decision check: no durable decision; a bug fix.
  • I have added a test that covers the exact scenario we are fixing.

The Connection tab matched oneOf branches on top-level keys only, so a
stored S3 securityConfig resolved to the Azure branch and its secrets
rendered as text. Match branches through nested keys, and drop the
configSource handler whose schema paths no longer exist.

Cover masking for every connector schema, required-field validation on
the add-service form, and masking on a saved service end to end.
Add a Datalake S3 case, the shape the fix changes, assert the value
the server masks secrets to, and map the Connection tab sources to the
spec in the Playwright impact map.
@sweta1308
sweta1308 requested a review from a team as a code owner November 24, 2026 13:43
@sweta1308
sweta1308 requested a review from karanh37 November 24, 2026 13:43
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1094 passed · 154 skipped

Changed code executed by these browser tests: 6 / 6 lines (100%)

File Changed lines Executed %
src/utils/ServiceConnectionDetailsUtils.tsx 6 6 100%

@gitar-bot

gitar-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findings

Recursive schema-branch matching governs connection-secret masking; a misselected branch could expose stored credentials as readable text across connectors.

Fixes connection secrets rendering as readable text on the Connection tab by matching oneOf branches through nested keys and removing the stale Datalake configSource special case. The one open-to-resolved finding was a Playwright spec that duplicated single-page coverage better handled by a cheaper layer, which has been addressed. No open issues found.

✅ 1 closed
✅ Quality: New Playwright spec checks single-page behaviour a cheaper layer covers

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ServiceConnectionSecretMasking.spec.ts:168-182 📄 .github/playwright/impact-map.json:781-788
Each case in this spec opens one page and checks that one input is type=password with value *********, first on the Connection tab and then in the edit form. Both checks would still hold with the backend mocked, which is the test this repo uses to move a test out of Playwright. The file's own header says ServiceConnectionDetails.browser.test.tsx already covers every connector's schema for the Connection tab. The one part that needs a real server is that a non-bot read returns *********, and that belongs in a Java IT (PasswordEntityMaskerTest). Under the browser-mode testing record and the frontend-browser-tests rule, a Playwright test has to fail for a reason no cheaper layer could catch. This spec adds five services, each with its own create/delete cost, to the Basic project on every change to these files.

Fix: move the edit-form check into a browser test that serves the stored entity through serveEntity with the masked value. Leave the server-side masking to the Java IT. Then drop this spec and its impact-map entry.

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

@sweta1308
sweta1308 merged commit d1eb66b into main Nov 25, 2026
62 checks passed
@sweta1308
sweta1308 deleted the test/connection-secret-masking branch November 25, 2026 14:03
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.

Connection secrets in shared oneOf branches render unmasked on the Connection tab

2 participants