Skip to content

fix(security): second batch of backend security-hardening fixes - #36638

Merged
mohityadav766 merged 21 commits into
mainfrom
fix/security-hardening-2
Nov 3, 2026
Merged

mohityadav766 merged 21 commits into
mainfrom
fix/security-hardening-2

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

A second batch of backend security-hardening fixes from an internal review, one commit per area:

  • User accounts: credential handling in write responses and version history, admin-flag changes, users CSV import/export authorization, self sign-up registration domains, identity comparisons.
  • Sign-in: email-domain allowlist enforcement for provider tokens.
  • Stored secrets: the RDF projection and diff, storage manifest credentials, ingestion pipeline source updates.
  • Search visibility: the column grid, search lineage and its exports, platform lineage, hierarchy search.

Each commit carries its own regression tests. The rules they set are recorded under docs/decisions/; details are tracked internally.

Upgrade note: deployments that set allowedEmailDomains need the identity provider to put the user's email in a principal claim, or map it. Provider tokens without one are now refused at sign-in.

Tracking: open-metadata/openmetadata-collate#7797, open-metadata/openmetadata-collate#7795

🤖 Generated with Claude Code


Summary by Gitar

  • Sessions:
    • Leaves the session cookie untouched on requests that sent none

This will update automatically on new commits.

… writes

- User versions, history and PUT/PATCH/POST/DELETE responses never carry a
  stored password hash or bot token; another user's email is masked there as
  it is on reads.
- A non-admin PUT keeps the stored admin flag, and a non-admin CSV row cannot
  change an existing user's admin flag.
- Users CSV import and export authorize against users as a whole rather than
  against a user who shares the team's name.
- Self sign-up through the users API applies the registration domains.
- With an email-domain allowlist, a provider token must carry an email (in any
  principal claim) in an allowed domain.
- Identity comparisons use sameIdentifier instead of equalsIgnoreCase.
…ines

- The RDF graph, JSON-LD and diff no longer carry connections, pipeline
  source configs, server connections or authentication mechanisms; the
  ontology and contexts stop advertising them.
- The RDF diff, which reads stored versions directly, is admin only, and a
  user's RDF needs access to the user's email.
- Storage manifest configs are typed like dbt ones, so their store
  credentials are masked on read and encrypted at rest.
- A caller who sees an ingestion pipeline's secrets masked must enter them
  again when the dbt or manifest source they belong to points elsewhere,
  on PUT and PATCH.
The column grid aggregates over the table and data model search documents,
so with search access control on it now ANDs the caller's policy filter into
every query it runs, as search does.
- Search lineage, its direction and entity-count variants, the CSV exports
  (sync and async) and data quality lineage drop the nodes the caller cannot
  view, the nodes reachable only through them, edges to them, pipelines on
  edges the caller cannot view, and upstream-lineage entries naming them.
- Platform lineage, the whole catalog's lineage at once, is admin only.
…chy search

The hierarchy rewrite turns the caller's query into one should clause among
name matches, so a term matching by name came back without meeting the
caller's search access policies, query_filter or deleted flag. They are now
applied around each query it builds; the parents that only draw the tree,
including those fetched for hits whose parent missed the page, still meet
the policies and the deleted flag.
Provider tokens must carry an email while sign-in domains are restricted,
only admins grant or revoke the admin flag, the RDF projection never carries
stored secrets, search lineage returns only assets the caller can view, and
the connection secrets guard now covers ingestion pipeline sources.
# Conflicts:
#	openmetadata-service/src/test/java/org/openmetadata/service/security/JwtFilterTest.java
@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.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit 8378e4f

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 28 0 0 0 5m 58s
ldap ✅ pass 7 0 0 0 0m 45s
keycloak-oidc-confidential ✅ pass 12 0 0 0 1m 25s
keycloak-oidc-public ✅ pass 11 0 0 0 1m 30s
msal-mock ✅ pass 7 0 0 0 0m 36s
auth0-mock ✅ pass 6 0 0 0 0m 36s
okta ⏩ skipped - - - - -
keycloak-azure-saml ✅ pass 23 0 0 0 6m 19s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

Totals: 94 passed · 0 failed · 0 flaky · 0 skipped · duration 17m 11s

@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 30, 2026
@mohityadav766
mohityadav766 removed this pull request from the merge queue due to a manual request Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-10-30T09:45:13Z)

The entry left the queue before it was built, so no checks ran against it.

@mohityadav766
mohityadav766 added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-11-02T08:28:44Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Features/OntologyDataExploreRdf.spec.ts › renders cross-page relations while paging 100+ tagged assets

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-11-02T14:00:31Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Features/OntologyDataExploreRdf.spec.ts › renders cross-page relations while paging 100+ tagged assets

mohityadav766 and others added 3 commits November 3, 2026 09:14
#36798 put the Studio workspace inside a wrapper div, so the sub-bar's nav
is no longer a direct child of the shell and `:scope > nav` finds nothing.
The rdf Playwright lane runs only when RDF paths change, so #36798's
merge-queue run skipped this spec; main's scheduled run and every merge
group that turns the lane on now fail it. The sub-bar's test id does not
depend on where the wrapper puts the nav.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 1024 → 1028
- 4 added, 0 removed, 37 changed spec-list

New source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaTable/ColumnCustomPropertyCell.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/Form/JSONSchema/JsonSchemaWidgets/LdapRoleMappingWidget/LdapRoleMappingWidget.tsx
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/components/AccessTokenRow.tsx
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/access-control/AccessControlRulesTable.tsx

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/e2e/fixtures/pages.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/Entity.interface.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/isolatedUser.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/aiProfile.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/apiResponse.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/customProperty.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/dragDrop.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  … and 27 more

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-11-03T04:40:32Z)

The entry left the queue before it was built, so no checks ran against it.

A silent re-authentication could lose its pending session to a refresh that
was already in flight. The refresh carried no session cookie, the server
answered it with an expiring OM_SESSION, and that response could reach the
browser just after the login's, deleting the pending-session cookie the
login had set. The callback then found no session and sent the user to
sign in. A cookie is now cleared only when the request carried one,
malformed values included.
@gitar-bot

gitar-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 closed / 1 findings

🔴 High risk · Changing admin-flag authorization, sign-in allowlists, secret masking, and lineage visibility could grant unauthorized access or expose credentials if enforcement is incorrect.

Adds a second batch of backend security-hardening fixes covering user credential handling, email-domain allowlist enforcement at sign-in, stored secret handling, and search visibility, each with regression tests. Approved with one open suggestion: the dbt re-entry test in IngestionPipelineResourceIT.java should read back the stored config after each PATCH to verify which token is persisted, since it currently only checks that the calls don't throw.

💡 Quality: dbt re-entry test never checks which token ends up stored

📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/IngestionPipelineResourceIT.java:1741-1755

The last two PATCHes in test_dbtTokenMustBeReenteredWhenTheSourceMoves only check that the server doesn't throw. Nothing reads the stored config afterwards. Suppose the server ignored entered-again and kept the original token after the move to elsewhere.example, which is the exact leak this test is about. Or suppose the dbtUpdateDescriptions patch wiped the token. The test would pass in both cases. Fix: after each patch, read the pipeline as the ingestion bot, which gets the unmasked secret. Assert that the token is still token after the first patch, and entered-again with the new URL after the second.

Check the unmasked stored token after each allowed patch
IngestionPipeline moved = asOwner.ingestionPipelines().patch(pipeline.getId(), /* url + token ops */ ...);
IngestionPipeline stored =
    SdkClients.ingestionBotClient().ingestionPipelines().get(pipeline.getId().toString());
DbtCloudConfig storedCloud =
    JsonUtils.convertValue(
        JsonUtils.convertValue(stored.getSourceConfig().getConfig(), DbtPipeline.class)
            .getDbtConfigSource(),
        DbtCloudConfig.class);
assertEquals("entered-again", storedCloud.getDbtCloudAuthToken());
assertEquals(URI.create("https://elsewhere.example"), storedCloud.getDbtCloudUrl());
🤖 Prompt for agents
Code Review: Adds a second batch of backend security-hardening fixes covering user credential handling, email-domain allowlist enforcement at sign-in, stored secret handling, and search visibility, each with regression tests. Approved with one open suggestion: the dbt re-entry test in `IngestionPipelineResourceIT.java` should read back the stored config after each PATCH to verify which token is persisted, since it currently only checks that the calls don't throw.

1. 💡 Quality: dbt re-entry test never checks which token ends up stored
   Files: openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/IngestionPipelineResourceIT.java:1741-1755

   The last two PATCHes in `test_dbtTokenMustBeReenteredWhenTheSourceMoves` only check that the server doesn't throw. Nothing reads the stored config afterwards. Suppose the server ignored `entered-again` and kept the original token after the move to `elsewhere.example`, which is the exact leak this test is about. Or suppose the `dbtUpdateDescriptions` patch wiped the token. The test would pass in both cases. Fix: after each patch, read the pipeline as the ingestion bot, which gets the unmasked secret. Assert that the token is still `token` after the first patch, and `entered-again` with the new URL after the second.

   Fix (Check the unmasked stored token after each allowed patch):
   IngestionPipeline moved = asOwner.ingestionPipelines().patch(pipeline.getId(), /* url + token ops */ ...);
   IngestionPipeline stored =
       SdkClients.ingestionBotClient().ingestionPipelines().get(pipeline.getId().toString());
   DbtCloudConfig storedCloud =
       JsonUtils.convertValue(
           JsonUtils.convertValue(stored.getSourceConfig().getConfig(), DbtPipeline.class)
               .getDbtConfigSource(),
           DbtCloudConfig.class);
   assertEquals("entered-again", storedCloud.getDbtCloudAuthToken());
   assertEquals(URI.create("https://elsewhere.example"), storedCloud.getDbtCloudUrl());

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-11-03T06:09:47Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Pages/AIProfile/ProfileMembers.spec.ts › Should navigate from the users page to a role detail
  • Pages/AIProfile/ProfileTeam.spec.ts › Should confirm a team move in a popover, not a modal

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-11-03T09:23:43Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Features/AIMode/AiObservabilityAlerts.spec.ts › saves every destination kind with its receivers and authentication

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

4 participants