Repository navigation
Fixes 38598: Mask connection secrets nested in shared oneOf branches - #38599
Conversation
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.
UI browser testsRan: 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%)
|
The Playwright spec only checked single-page rendering that still holds with the backend mocked; the server-side masking it relied on is covered by PasswordEntityMaskerTest. Cover the edit form in browser mode with the same five secret shapes, and map the Connection tab sources to the existing ServiceForm spec instead.
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findingsRecursive 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 ✅ 1 closed✅ Quality: New Playwright spec checks single-page behaviour a cheaper layer covers
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 |
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:
configSource.securityConfig.awsSecretAccessKey,awsSessionToken,gcpConfig.privateKeypbitFilesSource.securityConfig.awsSecretAccessKey,awsSessionToken,gcpConfig.privateKeymetastoreConnection.authType.gcpConfig.gcpConfig.privateKeyconnection.authType.gcpConfig.gcpConfig.privateKeyThe read-only view (
ServiceConnectionDetailsUtils) picked aoneOfbranch 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 declaresecurityConfig, and Azure comes first, so an S3 config was read through Azure's branch and its secrets lost theirformat: passwordmarker. A database-onlyconfigSourcehandler also looked updefinitions.S3Config/definitions.GCPConfig, which no connection schema has any more.getSchemaPropertiesnow scores branches against the stored value through nested keys.handleDatabaseConfigSourceis removed; Datalake'sconfigSourcegoes through the generic path, which already follows$refandoneOf.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:
High-level design:
src/utils/ServiceConnectionDetailsUtils.tsx. Branch matching recurses through nested objects (bounded by the existingMAX_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 isServiceConnectionDetails.component.tsx.gcpConfigfields; it now also showsgcpImpersonateServiceAccount, as every other nested config is shown. Secrets stay masked either way.ServiceConnectionDetails.browser.test.tsxwalks every connector's schema (service-type enums ×serviceUtilClassBaseloaders, 11 categories), finds everyformat: passwordfield through$ref, nested objects andoneOf/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 (RedshiftauthTypeoneOf, Snowflake flat field in a synthesizedauthType, Kafka top-level, Tableau non-database, Datalake shared-branchsecurityConfig); the secret is a password input holding*********.*********for non-bot users) is covered byPasswordEntityMaskerTest.Tests:
Use cases covered
Unit tests
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 onmain.npx jest src/utils/ServiceConnectionDetailsUtils.test.tsx src/components/Settings/Services/ServiceConnectionDetails/ServiceConnectionDetails.test.tsx --coverage: 25/25 passed;ServiceConnectionDetailsUtils.tsx88.77% lines, 89.1% statements. The uncovered lines are the untouched Airflow / metadata JWT / GitHub-credentials special handlers.ServiceConnectionDetails*,components/integration,ServiceDetailsPage): 23 suites, 358/358 passed.ServiceConnectionDetails.browser.test.tsx: 11/11 passed. Onmainit fails on the 8 fields in the table above.AddServicePage.browser.test.tsx: 6/6 passed. It fails (6/6) whenPasswordWidgetis mapped to the text widget.EditConnectionFormPage.browser.test.tsx: 5/5 passed. It fails (5/5) whenPasswordWidgetis mapped to the text widget.Local results on
609e3eb:Backend integration tests
Ingestion integration tests
Playwright (UI) tests
.github/playwright/impact-map.jsonnow mapsServiceConnectionDetails/**andServiceConnectionDetailsUtils*toFlow/ServiceForm.spec.ts(Ingestion), which opens the Connection tab, so changes there no longer trigger the full suite;impact-map.generated.jsonregenerated (--checkpasses).Flow/ServiceForm.spec.ts(Ingestion lane), the spec the impact map selects for the changed sources, run locally on609e3ebagainst this branch's UI: 13/13 passed.Manual testing performed
:8585; this branch's UI served by Vite on:3005proxying/apito it.configSource.securityConfig(awsAccessKeyId,awsSecretAccessKey,awsRegion).awsSecretAccessKeyis a password input holding*********;awsAccessKeyIdis readable. Onmain's UI the same field istype="text".*********.(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):awsSecretAccessKeyrenders as a readabletype="text"input, and the S3 fields lose their descriptions because the view reads them through the Azure branch.After (this PR):
awsSecretAccessKeyis atype="password"input;awsAccessKeyIdstays readable and the S3 field descriptions are back.Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.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.tsxkept deliberately as the validation coverage open-metadata/openmetadata-collate#3105 asks for.5a9e387158f(review-bot suggestion): Playwright spec replaced byEditConnectionFormPage.browser.test.tsx; tests and CI test selection only, production code unchanged since the review.