You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Check team grants, placement and membership against the resulting state, and tighten DomainOnlyAccessPolicy - #36695
Aligns team and domain-only authorization with the rules already applied to user roles: team grants, team placement and team membership are checked against the state a write produces, and DomainOnlyAccessPolicy covers administration resources.
What changed
Team roles and policies: adding a default role or policy to a team needs an admin, on POST, PUT, PATCH and team CSV import, as assigning a role to a user does. Removing one, or resending the ones a team already has, is unchanged, so an exported CSV still re-imports. Impersonated requests follow the same rule as for user privileges.
Team parents: adding a parent to a team needs the same permission as editing that parent, on REST and in team CSV import. The organization is exempt.
Closed teams: a user PATCH is judged on the teams it leaves the user in, so every patch operation gets the same admin check.
DomainOnlyAccessPolicy: keeps its allow and deny rules and gains two deny rules: creating, editing, deleting or deploying policies, roles, bots and apps in any domain, and creating, editing or deleting teams and users in no domain and bot users (noDomain() || isBotUser()). Running an app as configured, such as AutoPilot for a service, stays allowed. Assets in no domain stay fully editable. A 2.1.0 migration adds the rules to stored policies, customised ones included.
Behaviour changes
Adding roles or policies to a team, or placing a team under a parent, now needs an admin or edit permission on that parent, including for team owners and bots.
Team CSV import is not available to impersonated requests.
Domain-only users need another role to change policies, roles, apps or bots in any domain, or teams and users in no domain; a deny wins over that role. Their access inside their domains and to assets in no domain is unchanged. A domain-only user with no domain needs another role to edit their own profile, and a domain-only owner of a team in no domain to manage it.
Sign-in team claims (SSO/SAML), self sign-up, SCIM and seeded sample data write through the repository or as admin and are unchanged.
A deny takes precedence over other roles, so users holding DomainOnlyAccessRole cannot change policies, roles, bots or apps even when another role allows it. Deployments that delegate these to domain-scoped users need to adjust DomainOnlyAccessPolicy; the upgrade adds each new rule once.
The upgrade does not change team roles, policies, parents or memberships that are already set; admins may want to review them.
Tests
New tests in TeamResourceIT, UserResourceIT, BotImpersonationIT, DomainIsolationIT (including a table in no domain staying editable) and DomainOnlyAccessPolicySqlMigrationTest (MySQL and Postgres) fail without the change and pass with it.
Upgrade end to end on MySQL and Postgres: released 2.0.7 stack, this branch's migrate, then this branch's server. The stored policy gains the new rule and the schema moves to 2.1.0; the API checks for the changes above behave as described after the upgrade.
Implementation notes
TeamResource uses the existing authorizeCreateOrUpdate / prepareCreateOrUpdateAuthorization hooks for create, PUT and bulk PUT, and overrides patchInternal to apply the patch and compare the result, following QueryResource.
TeamRepository.TeamCsv loads the stored team once per row (non-admins only) and checks added roles, policies and parents; parents the team already has, the import root and teams created by the same file are skipped.
UserResource.patch keeps validateTeamAddition for add operations and moves the closed-team check after the loop, reusing joinsClosedTeam.
The DomainOnlyAccessPolicy rules list resource types and cover no view operation, so search filtering is unchanged. The migration appends each rule where no rule of that name exists and sits with the other 2.1.0 policy updates.
Team edits that add default roles or policies now need an admin, on PATCH,
PUT and CSV import alike, matching how roles are assigned to users. Placing
a team under a parent needs the same permission as editing that parent.
A user PATCH that changes team membership is judged on the teams the patch
leaves the user in, so every way of writing the change is checked the same.
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.
A newly added parent needs EDIT_ALL on it, checked as the importing user;
parents the team already has, the import root and teams created by the
same file are skipped.
The allow rule now uses a new inUserDomains() function (own-domain
resources, plus listings and bulk requests that are filtered per item),
and a view rule keeps domainless resources readable. The 2.1.0 migration
updates the stored policy only while it still has the shipped rules.
sonika-shah
changed the title
Check team grants and membership changes against the resulting state
Fix team, membership and domain-only privilege escalations
Nov 2, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved authorization bypasses allow unauthorized logical-suite edits and impersonated-bot privilege escalation, while the security migration skips repository-saved policies because of its rule-order guard.
This PR tightens OpenMetadata authorization around team grants, parent relationships, closed-team membership, and domain-only access. It also updates existing installations while preserving customized policies.
Changes:
Adds authorization checks for team role, policy, and parent additions through REST and CSV import.
Checks resulting user memberships after PATCH and narrows domain-only grants on domainless resources.
Adds security regressions, guarded MySQL/PostgreSQL migrations, and decision records.
The repository stores rules sorted by name (allow before deny), so the
exact deny-then-allow comparison skipped installs whose policy was seeded
or edited through the API, leaving them unmigrated. Compare the two rules
by name, effect, resources, operations and condition instead, and cover
both dialects with a database-backed migration test.
A dry run gives a parent named by an earlier row a placeholder id, so a
non-admin re-importing an unchanged nested export had rows rejected for
parents they already have.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Missing search translation for inUserDomains() can bypass domain restrictions, while team PATCH processing before authorization leaks protected relationship information.
Both PATCH overloads apply the patch before authorizing access to the target team, so an unauthorized caller can distinguish matching relationship values or valid array indexes (403) from failed test operations or invalid indexes (patch errors). This reveals protected role and parent relationships. Run the canonical PATCH authorization before applying the patch in the shared helper, and add regressions showing that matching and nonmatching probes are both rejected with 403.
Untranslated functions are dropped from the search filter, so a policy
using inUserDomains() was filtered as if the clause were absent. It maps
to the hasDomain() query without the clause that keeps documents in no
domain; a user with no domains matches nothing.
Restore the original allow rule and add a deny rule for creating,
editing or deleting policies, roles, teams, users and bots in no domain,
and bots in any domain. This drops inUserDomains() and its search
translation; the deny covers no view operation, so search is unchanged.
The migration appends the rule to every stored policy that lacks it.
🔴 High risk · Tightening team-grant and domain-only authorization plus migrating stored policies could deny legitimate administration by domain-scoped users or team owners.
Tightens team and domain-only authorization so team grants, parents and membership are checked against the resulting state, and extends DomainOnlyAccessPolicy to administration resources. Resolved the inUserDomains() handling of entity-less write contexts, which now treats them as writes rather than listings. No open issues remain.
✅ 2 closed✅ Security: inUserDomains() treats any entity-less context as a listing, writes included
📄 openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/RuleEvaluator.java:258-265📄 openmetadata-service/src/main/resources/json/data/policy/DomainAccessPolicy.json:19-25📄 docs/decisions/2026-11-02-domain-only-access-grants-full-access-only-inside-the-users-domains.md:17-19 inUserDomains() returns true whenever resourceContext.getEntity() is null. The comment says this is for listings that are filtered per item, but plenty of write paths also authorize against an entity-less new ResourceContext<>(type), and none of them filter per item. Examples: EntityResource.deleteStaleEntities (DELETE, then bulkDeleteStaleEntities runs with no per-item check), OpenLineageResource.postLineage (EDIT_LINEAGE on ResourceContext<>(TABLE)), and AIGovernanceFrameworkResource.authorizeFork (CREATE). A user whose only grant is DomainOnlyAccessRole therefore keeps All operations there and can delete or edit resources outside their domains. That contradicts the new ADR, which says changing anything in no domain now needs another role. Fix: have the All rule match only single resources inside the user's domains (return false when the entity is null) and let the ViewAll/hasDomain() rule cover listings. If entity-less writes must keep working, scope the exemption by operation instead.
Closed: Bug: CSV parent check doesn't exempt the Organization, unlike REST and ADR
📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TeamRepository.java:1473-1482📄 docs/decisions/2026-10-30-only-admins-add-roles-or-policies-to-a-team.md:22-23
The REST check in TeamResource skips the edit check when the added parent is ORGANIZATION_NAME, and the updated ADR says the organization is exempt in team CSV import too. rejectParentsNotEditable only exempts the import root, parents the team already has, and teams created in the same file. So when a non-admin team owner imports a row that places a team (new or existing) directly under Organization, canEditParent is called on the Organization and the row is rejected with "which you cannot edit", while the same change over REST succeeds. Fix: add ORGANIZATION_NAME.equals(parent.getName()) to alreadyAllowed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aligns team and domain-only authorization with the rules already applied to user roles: team grants, team placement and team membership are checked against the state a write produces, and
DomainOnlyAccessPolicycovers administration resources.What changed
noDomain() || isBotUser()). Running an app as configured, such as AutoPilot for a service, stays allowed. Assets in no domain stay fully editable. A 2.1.0 migration adds the rules to stored policies, customised ones included.Behaviour changes
DomainOnlyAccessRolecannot change policies, roles, bots or apps even when another role allows it. Deployments that delegate these to domain-scoped users need to adjustDomainOnlyAccessPolicy; the upgrade adds each new rule once.Tests
TeamResourceIT,UserResourceIT,BotImpersonationIT,DomainIsolationIT(including a table in no domain staying editable) andDomainOnlyAccessPolicySqlMigrationTest(MySQL and Postgres) fail without the change and pass with it.migrate, then this branch's server. The stored policy gains the new rule and the schema moves to 2.1.0; the API checks for the changes above behave as described after the upgrade.Implementation notes
TeamResourceuses the existingauthorizeCreateOrUpdate/prepareCreateOrUpdateAuthorizationhooks for create, PUT and bulk PUT, and overridespatchInternalto apply the patch and compare the result, followingQueryResource.TeamRepository.TeamCsvloads the stored team once per row (non-admins only) and checks added roles, policies and parents; parents the team already has, the import root and teams created by the same file are skipped.UserResource.patchkeepsvalidateTeamAdditionforaddoperations and moves the closed-team check after the loop, reusingjoinsClosedTeam.DomainOnlyAccessPolicyrules list resource types and cover no view operation, so search filtering is unchanged. The migration appends each rule where no rule of that name exists and sits with the other 2.1.0 policy updates.docs/decisions/2026-10-30-only-admins-add-roles-or-policies-to-a-team.md,docs/decisions/2026-11-02-domain-only-access-cannot-change-administration-resources-in-no-domain.md.