Skip to content

Fixes 37701: Reserve the Admin role name and label the admin flag apart from roles - #37702

Merged
manerow merged 4 commits into
mainfrom
fix/admin-role-name-collision
Nov 18, 2026
Merged

manerow merged 4 commits into
mainfrom
fix/admin-role-name-collision

Conversation

@manerow

@manerow manerow commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #37701

Admin access is the isAdmin flag on a user or bot, not a role. The role editors list that flag as an option called "Admin" next to the real roles. Nothing stopped anyone from also creating a role named Admin, so the editor could show two identical "Admin" options: one makes the user a superuser, the other grants only its policies. It was easy to pick the wrong one.

This PR:

  • Server: rejects a new role named Admin (any case) with a 400. The check sits in RoleRepository.createNewEntity, which both POST and PUT-create go through. Roles cannot be renamed, so that is the only way in. Roles that already have the name keep working and stay editable.
  • UI: wherever the flag is listed among roles, it now reads "Admin (superuser)" (label.admin-superuser, translated in every locale). That covers the bot and user role editors (classic and AI mode), the read-only roles views, the user popover, the profile menu and the AI user menu.
  • UI, while there: an admin bot's role chips in the AI-mode editor showed the raw id admin, and the classic editors labelled any held role missing from the loaded page of roles as the admin flag. Both now show the right name.
  • Decision record: ADR:2026-11-12-admin-is-a-reserved-role-name.

Type of change:

  • Bug fix

High-level design:

  • Why reject at create, not migrate: existing roles named Admin may be referenced by name in policy conditions and integrations, so this PR does not rename them. The new label already tells them apart in the UI. Such a role still cannot be assigned through SSO role mapping (an Admin claim means the flag); renaming it is left to the admin.
  • Why createNewEntity: POST runs prepare(role, false), but PUT-create runs prepare(role, true), so prepare cannot tell a new role from an update. createNewEntity is the one method every create path shares. RoleResource has no bulk or CSV endpoint.
  • Why case-insensitive: a role named admin would look the same in the editors.

Tests:

Use cases covered

  • Creating a role named Admin or admin through POST or PUT returns 400 with a "reserved" message.
  • A bot or user with a custom role named Admin sees "Admin" and "Admin (superuser)" as two different options, and saving sends the role as a role and the flag as isAdmin.
  • An admin bot's role chips show "Admin (superuser)", not admin.
  • A held role that is not in the loaded role list is shown by its own name.

Unit tests

  • Jest, new: RolesCard.test.tsx (3 cases; the label cases fail without the fix), a new case in BotDetailPanel.test.tsx.
  • Jest, updated to the new label: UserRoles.test.tsx, PopoverContent.test.tsx, MembershipSection.test.tsx, PermissionsTab.test.tsx.
  • Ran src/components/common, Settings/Users, Settings/Bot and discovery/personal-space: 477 suites, 5,006 tests, all passed. ESLint and Prettier clean on changed files. yarn tsc:check shows no errors in changed files.

Backend integration tests

  • RoleResourceIT#test_roleNamedAdminIsRejected (POST and PUT, two spellings).

The run below is at 1e789f0172b1. The later commits change only UI files.

Local Java test run: PASSED

  • Commit: 1e789f0172b1 (base origin/main)
  • Finished: 2026-11-12 19:14 UTC · 3.8 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 9 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (1 class) 1 5 0 0 1.1 passed
integration mysql-elasticsearch · parallel 1 217 0 31 2.7 passed
  • Impacted, not run locally: 6 classes (listed in the details)

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable for new specs: the change is a label, covered by Jest.
  • Not run locally. make playwright_affected selects about 50 specs, most because its map has no entry for RoleRepository or the role components. The relevant ones (Roles, BotsProfile, Users, AIProfile/ProfileDetails) use toContainText('Admin'), which the new label still satisfies. They are pending for the merge queue.

Manual testing performed

None on a running stack. The behaviour is covered by the IT and Jest cases above.

UI screen recording:

Not applicable: a bug fix that changes a label, not a UI feature.

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

  • 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 at 2702ba80da71 (three passes; every 🔴 fixed). 🟡 left open, all non-blocking: the AI-mode bot editor still shows a held role missing from the loaded list by its id (pre-existing); UserProfileRoles, UserProfileIcon, RolesElement and AIUserMenu have no Jest case for the new label; UserProfileRoles' admin chip shares the React key Admin with a legacy role named Admin, because Chip keys by name (pre-existing).
  • Decision check: adds docs/decisions/2026-11-12-admin-is-a-reserved-role-name.md.

  • I have added a test that covers the exact scenario we are fixing.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge; no actionable issues were found.

Summary

Reserves Admin, ignoring case, for new roles and labels the isAdmin flag as “Admin (superuser)” across the changed user and bot views.

  • New roles cannot use the name Admin, regardless of case.
  • Role editors and profile views distinguish the admin flag from real roles.

Reviews (1) · Last reviewed commit: "Merge branch 'main' into fix/admin-role-..." · Reviewed by Greptile

@manerow
manerow requested review from a team as code owners November 12, 2026 19:21
@manerow

manerow commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Local Java test run: PASSED — details

  • Commit: 1e789f0172b1 (base origin/main)
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (1 class): CatalogExceptionMessageTest (5 passed)
  • integration · mysql-elasticsearch · parallel: BaseEntityIT$ListEntityHistoryByTimestampPaginationTest (185 passed, 31 skipped), RoleResourceIT (1 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Broader coverage not executed by this focused run

  • mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=ApprovedGlossaryTermGuardTest,CachedPermissionEvaluationTest,CatalogExceptionMessageTest,ChannelRegistryTest,ColumnRepositoryImportTest,ElasticSearchRBACConditionEvaluatorTest,EntityUtilTest,ListFilterTest,OpenSearchRBACConditionEvaluatorTest,PaginatedEntityTimeSeriesSourceStaleRelationshipTest,PermissionDebugServiceTest,RdfReindexResourceTest,RuleEvaluatorTest,SubjectCacheTest,SubjectContextTest,TagLabelUtilTest,TeamHierarchyResolverTest -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<498 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state '-Dit.test=<35 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf '-Dit.test=<37 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=AlertStateIT,BundleWarmupCertificationIT,ContainerCacheCorrectnessIT,EntityCacheWriteOrderIT,OneTransactionFlushAtomicityIT,RelationshipCacheInvalidationIT,TagRenameCacheIT,UncachedReadIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=global-state -Dit.test=CredentialRedisDownIT,CredentialRedisNoRoundTripIT,SessionRedisMultiNodeIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel -Dit.test=FlattenedChildrenHighlightSearchIT,InheritedFieldPropagationRecoveryIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=PatchTableEmbeddingIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=SearchAccessRulesIT,SearchAggregateRbacIT,SearchClusterFitnessReindexE2EIT,SearchCountConsistencyIT,SearchEntityRankingIT,SearchRelevancyPreviewIT,SearchScoringIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Impacted, not run locally (6)
  • ReindexBenchmarkIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • GoogleSsoSignInUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • EntityLoaderSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableAllKindsDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • GoogleSsoBootstrapUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=CatalogExceptionMessageTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=RoleResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

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.

@gitar-bot

gitar-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Rejecting new Admin-named roles and distinguishing the superuser flag in the UI could disrupt workflows that rely on creating that previously accepted role.

Reserves the Admin role name at create time and labels the admin flag as "Admin (superuser)" across role editors and menus, so it no longer collides with a custom role named Admin. No open findings remain.

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

@manerow
manerow merged commit 27ea2c4 into main Nov 18, 2026
57 of 59 checks passed
@manerow
manerow deleted the fix/admin-role-name-collision branch November 18, 2026 12:45
manerow added a commit that referenced this pull request Nov 18, 2026
manerow added a commit that referenced this pull request Nov 18, 2026
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.

Role editors show two identical "Admin" options when a role named Admin exists

3 participants