Skip to content

[1.13] Fixes #31770: restrict direct users to Group teams - #32373

Merged
yan-3005 merged 15 commits into
1.13from
backport-31770-1.13
Sep 7, 2026
Merged

yan-3005 merged 15 commits into
1.13from
backport-31770-1.13

Conversation

@yan-3005

@yan-3005 yan-3005 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #31770

Backports the non-Group team user-membership validation to 1.13. Direct user memberships are now rejected for Department, Division, and BusinessUnit teams across team and user write paths. Existing invalid data requires the agreed DB cleanup; this PR intentionally adds no migration or API bypass.

Type of change:

  • Bug fix

High-level design:

Validation is at the relationship write boundaries. The shared test bootstrap assigns its users to existing child Group teams, so it remains valid without changing downstream test semantics.

Tests:

  • Updated TeamResourceIT and UserResourceIT for the affected API paths.
  • mvn spotless:apply passed.
  • CI will run the integration suite.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue via Fixes #31770 above.
  • I have added tests covering the changed behavior.

@yan-3005
yan-3005 requested a review from a team as a code owner September 1, 2026 13:44
@github-actions

github-actions Bot commented Sep 1, 2026

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 Sep 1, 2026
mohityadav766 added a commit that referenced this pull request Sep 2, 2026
…ss-test delete race

Fixes the last family of failures on the mysql lanes, and most of what is left
on postgres-opensearch. Symptom is one of:

  Api <entityService> instance for <uuid> not found
  Cannot invoke "EntityReference.getFullyQualifiedName()" because
      the return value of "Dashboard.getService()" is null

Single root cause: service-backed entity ITs create a fresh service per entity,
so an unqualified listEntities returns rows belonging to sibling tests. When a
sibling's @AfterEach hard-deletes its service mid-list, server-side hydration of
that row's service ref either throws or yields null.

BaseEntityIT gains a getEntityServiceFqn hook (default null, so non-service
entities are unaffected) and pins every unqualified list call to the entity's own
service. Service-backed subclasses override it. Also bumps the hard-delete
visibility wait from 15s to 45s for the change-event pipeline on the
pg-es-redis parallel lane, and waits for accepted async bulk entities before
asserting on them.

Taken from PR #32340 byte for byte, except for two classes it does not cover:

- PipelineResourceIT: same 7-line override; it hits the identical error and is
  the class that failed on the postgres-opensearch lane.
- DashboardResourceIT: same override, plus test_listDashboardsByService listed
  unscoped with limit=100 and then dereferenced getService() on every returned
  row. It builds its own ListParams, so the base-class hook cannot reach it —
  scoped the call to the service the test created, which is what a test of that
  name was already meant to do. Swept the module for the same shape; this was
  the only other instance (DatabaseSchemaResourceIT already scopes via
  setDatabase).

AuditLogResourceIT and RecognizerFeedbackRepositoryTest are pre-existing
failures on 1.13 unrelated to this branch (both also fail on #32373, the latter
also on #32371); their #32340 fixes are included since they are test-only.

Verified: test-compile and spotless clean across the module.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mohityadav766 added a commit that referenced this pull request Sep 2, 2026
The openmetadata-service unit lane is red on every 1.13 PR, not just this one:
8 failures on #32400, #32371 and #32373. This branch already showed 6 — a strict
subset, the other 2 (AuthenticationCodeFlowHandlerTest) having been fixed by
#32408 landing on the base. Nothing here was caused by this branch; these are
the remaining 6.

Three assert against entities and fields that only exist on main/2.0, having been
backported wholesale:

- IndexMappingNestedFieldConsistencyTest asserted mappings for auditReport,
  aiApplication, llmModel and aiGovernance. None of those entities exist on 1.13.
- SearchIndexFactoryTest asserted page reindex fields include "parent"; page
  hierarchy is main-only.
- SearchRepositoryBehaviorTest expected the column child index to be aliased
  cluster_column_search_index; on 1.13 it is cluster_tableColumn.

EntityCsvTest covers domain/data-product validation on bulk edit.

SearchRepositoryBehaviorTest also gains a test for an EXTERNAL_HANDLER-only
change emitting no child-update call, which needs the accompanying
SearchRepository fix: appendUpdate/appendDelete/appendCreate appended a
separator unconditionally, so a propagation whose switch branch deliberately
emits nothing (certification, driven by propagateCertificationTags) produced a
whitespace-only script that still fired updateChildren against every child
index. The three guards only append the separator when the branch actually
wrote something.

That makes two product changes on this branch: the TestCaseRepository
null/EntityNotFound guard and these three separator guards. Everything else is
test-only.

Verified locally: EntityCsvTest 63, SearchIndexFactoryTest 200,
SearchRepositoryBehaviorTest 115, IndexMappingNestedFieldConsistencyTest 4 —
382 tests, 0 failures, 0 errors. Spotless clean.

Taken from PR #32340 byte for byte.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@yan-3005 yan-3005 changed the title Fixes #31770: restrict direct users to Group teams [1.13] Fixes #31770: restrict direct users to Group teams Sep 3, 2026
@yan-3005
yan-3005 requested a review from a team as a code owner September 3, 2026 10:27
@gitar-bot

gitar-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Backports team user-membership validation to 1.13, restricting direct user assignments to Group teams only for Department, Division, and BusinessUnit teams. Validation is enforced at relationship write boundaries, addressing the issue where origTeams validation was blocking user removal from legacy teams.

✅ 1 resolved
✅ Edge Case: Validating origTeams blocks removing users from legacy teams

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java:1468-1471
updateTeams calls validateGroupTeams(origTeams) on the user's existing teams. On any PUT to a user, patchedFields is null so shouldCompare("teams") is always true and this runs on every update. If a user has legacy (pre-fix) membership in a Department/Division/BusinessUnit team, validating the original teams throws, meaning the user can no longer be updated at all — including the update that would remove them from the invalid team via API. The PR intends DB cleanup, but validating origTeams is unnecessary (only the target/updatedTeams state needs to be legal) and actively prevents self-healing. Drop validateGroupTeams(origTeams) and validate only updatedTeams.

Options

Display: compact → Showing less information.

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

@yan-3005
yan-3005 merged commit ac8ae2d into 1.13 Sep 7, 2026
145 of 153 checks passed
@yan-3005
yan-3005 deleted the backport-31770-1.13 branch September 7, 2026 15:04
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@yan-3005 yan-3005 self-assigned this Nov 19, 2026

This branch was previously deployed

1 inactive deployment
test — f004a1de Deployed Sep 7, 2026 by yan-3005 via playwright-ci-postgresql (2, 6) #81308
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.

3 participants